Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL - PL/SQL Question. Please Help!!
In article <376acabe.7734561_at_netnews.worldnet.att.net>,
jonathan_at_gennick.com wrote:
> On Tue, 15 Jun 1999 16:28:11 -0700, "George Gifford"
> <georgegifford@~usa~.net <--- ANIT-SPAM (Remove ~)> wrote:
>
> >Does anyone have any suggestions or pl/sql code that will accept a
tablename
> >and then update/replace ALL Null Numeric fields with a 0, and all
Null
> >VarChar2 Fields with a space (' ')??
>
> Here is a SQL statement that should work for you:
>
> UPDATE TABLEX
> SET NUMFIELD = NVL(NUMFIELD,0),
> CHARFIELD = NVL(CHARFIELD,' ');
>
> Make sure that you do change your varchar2 field to one
> space. Oracle will interpret '' as null, but ' ' is one
> space and is not null.
>
> regards,
>
> Jonathan
>
> _____________________________________________________
> jonathan_at_gennick.com
> http://gennick.com
> Brighten the Corner Where You Are
>
If you had many columns within the table that you want to update then simply drive the above from the data-dictionary :
User_Tab_Columns Where Table_Name = XTable_Name.
You should then be able to generate SQL from SQL to do the whole
thing... a lot quicker than PL/SQL .
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Received on Wed Jun 16 1999 - 12:44:53 CDT
![]() |
![]() |