Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4042680
  • 博文数量: 536
  • 博客积分: 10470
  • 博客等级: 上将
  • 技术积分: 4825
  • 用 户 组: 普通用户
  • 注册时间: 2006-05-26 14:08
文章分类

全部博文(536)

文章存档

2024年(3)

2021年(1)

2019年(1)

2017年(1)

2016年(2)

2013年(2)

2012年(10)

2011年(43)

2010年(10)

2009年(17)

2008年(121)

2007年(252)

2006年(73)

分类: Oracle

2007-07-20 11:43:47

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;
阅读(1747) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~