Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: PL/SQL-if-statement
Maybe I am missing something, but if this is only one table that you are trying to change a field from NULL to 000000 then why not UPDATE the table SET column = 000000 where column is NULL; before you run the procedure against the table. To prevent the column from being loaded as NULL place a constraint on the column and the load will bomb out. You will then have ammunition to go back to the source and get it corrected. Make life simple.... get GOOD DATA IN THE BEGINNING. ROR mª¿ªm
>>> rajendra.jamadagni_at_espn.com 04/19/01 12:35PM >>>
vOWNER_NO := lpad(nvl(vOWNER_NO,'0'), 6, '0');
This will return a string of six zeros if VOWNER_NO is null, else it will left pad the vOWNER_NO to make it six character in length.
HTH
Raj
QOTD: Any clod can have facts, but having an opinion is an art !
-----Original Message-----
Sent: Thursday, April 19, 2001 10:56 AM
To: Multiple recipients of list ORACLE-L
How can I change this pl/sql code, in the while-statement maybe so that
if the field OWNER_NO is NULL, then it should be written six characters?
The code looks like
this:
"IF recCursor.OWNER_NO is null then
vOWNER_NO := '000000';
else
v_OWNER_NO:= to_char(recCursor.OWNER_NO);
WHILE length(vOWNER_NO) < 6 LOOP
vOWNER_NO '0'0' || vOWNER_NO;
END LOOP;
END IF;
How shoud I write to fix this script so therw will be written out 6
characters if the field OWNER_NO is empty. I want to use the WHILE LOOP. Any
one whom can help me with this?
Roland Sköldblom
This e-mail message is confidential, intended only for the named recipient(s) above and may contain information that is privileged, attorney work product or exempt from disclosure under applicable law. If you have received this message in error, or are not the named recipient(s), please immediately notify ESPN at (860) 766-2000 and delete this e-mail message from your computer, Thank you.
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Jamadagni, Rajendra INET: rajendra.jamadagni_at_espn.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). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Ron Rogers INET: RROGERS_at_galottery.org 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 Fri Apr 20 2001 - 07:40:03 CDT
![]() |
![]() |