Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: SQL - PL/SQL Question. Please Help!!

Re: SQL - PL/SQL Question. Please Help!!

From: Kenneth C Stahl <kstahl_at_lucent.com>
Date: Thu, 17 Jun 1999 10:51:03 -0400
Message-ID: <37690B57.52E58031@lucent.com>


Not sure why you would want to do this. It isn't a very good use of your database and you'll waste space - especially with the ' ' in varchar2 fields.

Why not just build a view that uses nvl() for the columns that you want to modify. That way your actual data stays pure, but the presention comes out the way that you want.

for example, say you create a table like this:

create mytable (abc number(5);

                          def varchar2(5));

then, if you want to see null values in abc as 0 and null values in def as ' ', your view would be defined:

create or replace view myview as
select nvl(abc,0) abc,

          nvl(dev,' ') def;

Ken

"George Gifford

> 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 (' ')??
>
> Or a PL/SQL Block that will run through each record in a table and update
> specific fields with a default value???
>
> Any help would be greatly appreciated!!!
>
> George - SSI
Received on Thu Jun 17 1999 - 09:51:03 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US