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_at_lucent.com>


[Quoted] 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.

[Quoted] 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 [Quoted] 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 ' ', [Quoted] 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 - 16:51:03 CEST

Original text of this message