Home » SQL & PL/SQL » SQL & PL/SQL » how to determine the data type of a variable (Oracle 10g)
|
|
|
|
Re: how to determine the data type of a variable [message #475649 is a reply to message #475579] |
Thu, 16 September 2010 08:17   |
S.Rajaram
Messages: 1027 Registered: October 2006 Location: United Kingdom
|
Senior Member |
|
|
I assume you want to find out the datatype of a variable in pl/sql. I really don't know why you want to do that. But this is one way of doing it. It will work only when the variable is not null.
1 declare
2 numb number;
3 character varchar2(100);
4 text varchar2(100);
5 begin
6 numb := 123;
7 character := 'Hello World';
8 select dump(numb) into text from dual;
9 dbms_output.put_line(text);
10 select dump(character) into text from dual;
11 dbms_output.put_line(text);
12* end;
SQL> /
Typ=2 Len=3: 194,2,24
Typ=1 Len=11: 72,101,108,108,111,32,87,111,114,108,100
You have to decipher the Typ=<value>.
Regards
Raj
|
|
|
|
Goto Forum:
Current Time: Thu Jun 12 11:45:11 CDT 2025
|