pl/sql identifiers and literals
##############
identifiers
--------------
identifiers are names for pl/sql objects such as constants, variables, exceptions, procedures, cursors, and reserved words.
identifiers:
* can be up to 30 characters in length
* cannot include whitespace (space, tab, carriage return)
* must start with a letter
* can include a dollar sign ($), an underscore ( _ ), and a pound sign (#)
* are not case-sensitive
if you enclose an identifier within double quotes, then all but the first of these rules are ignored. for example, the following declaration is valid:
declare
"1 ^abc" varchar2(100);
begin
if "1 ^abc" is null then ...
end;
###############
literals
---------------
literals are specific values not represented by identifiers. for example, true, 3.14159, 6.63e-34, `moby dick', and null are all literals of type boolean, number, or string. there are no date or complex datatype literals as they are internal representations. unlike the rest of pl/sql, literals are case-sensitive. to embed single quotes within a string literal, place two single quotes next to each other. see the following table for examples.
literal actual value
'that''s entertainment!' that's entertainment!
'"the raven"' "the raven"
'tz="cdt6cst"' tz='cdt6cst'
'''' '
'''hello world''' 'hello world'
'''''' ''
###############
eg:
declare
stmt varchar2(1024);
begin
stmt := 'alter session set nls_date_format=''yyyy-mm-dd hh24:mi:ss''';
execute immediate stmt;
end;
阅读(1677) | 评论(0) | 转发(0) |