Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Conversion of datatype
I threw this together and it works fine. I had to have the char field be 7 when the number was set to 6 otherwise I received ORA-06502: PL/SQL: numeric or value error: character string buffer too small
SQL> declare
2 test_int number(6) := 1;
3 test_char char(7);
4
5 begin
6 test_char := to_char(test_int, '000009'); 7 dbms_output.put_line(test_char); 8 test_int := 33; 9 test_char := to_char(test_int, '000009'); 10 dbms_output.put_line(test_char);
000001
000033
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Brian Wisniewski INET: brian_wisniewski_at_yahoo.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Tue Feb 27 2001 - 10:58:35 CST