oracle - Can not check input number in SQL plus? -


i have example input number in form of oracle sql plus, , here code :

declare      wk_input number := &number; begin     if wk_input not number         dbms_output.put_line('is not number')     else         dbms_output.put_line(wk_input ||' number')     end if; end; 

when execute has error:

 encounter symbol 'number' when expecting of flow. 

how can check input number or not ? thank you.

there no "number" function in oracle. don't need here, however, because when declare variable wk_input of type number, can assign number or else you'll exception. write this:

declare   wk_input number; begin   wk_input := '&number';   dbms_output.put_line(wk_input||' number'); exception   when value_error     dbms_output.put_line('&number not number'); end; 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -