1

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 size 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!

1 Answer 1

4

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?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.