开发者

Variable declared with variable keyword in sql plus(oracle 9i)?

I am trying to declare g_num ,number data type with size it gives an error but in case of varchar2,char it does not.

variable g_name varchar2(5);//correct accept siz开发者_运维问答e for varchar 2
variable g_num number(23);//Gives an error

    " VAR[IABLE] [ <variable> [ NUMBER | CHAR | CHAR (n [CHAR|BYTE]) |
              VARCHAR2 (n [CHAR|BYTE]) | NCHAR | NCHAR (n) |
              NVARCHAR2 (n) | CLOB | NCLOB | REFCURSOR ] ]"

Please suggest!


The answer is already in your error message: NUMBER does not allow a precision in SQL*Plus.

VARIABLE g_num NUMBER;

works.

Here is a list with valid variable declarations in SQL*Plus.

The documentation says:

NUMBER
Creates a variable of type NUMBER with fixed length.


Unfortunately I don't know why you can't specify precision with SQL*Plus, but I have been able to store 1.0E+125 with my tests.

What do you need precision for?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜