June 11, 2008 at 12:16 pm
hi!
i am trying to use coalesce to return a blob field, and if it is null, it must replace the null with a default value.
e.g. coalesce(blob1,' '), this should bring the blob field as it is or put blanks in the field, when a null value is returned.
this is not working, as it seems that i can not use coalesce with blob field.
i also tried 'ifnull', and it did not help.
do you know how i can handle this?
Dineo.
June 11, 2008 at 12:38 pm
sorry i did not make my self clear enough.
I use embeded sql in an RPG program and RPG can not handle blobs unless i sql.
I need to insert records from one table to another.
e.g, assuming C is a blob field with possible null.
insert into Table1 (a,b,c)
(select a,b,coalesce(c, ' ') from Table2)
June 11, 2008 at 12:45 pm
Try this.
insert into Table1 (a,b,c)
(select a,b,
CASE c WHEN NULL THEN ' ' ELSE c END
from Table2)
June 11, 2008 at 1:26 pm
sorry, i had some typo there. but rpg does not recgnise isnull.
check my code now.
C/Exec SQL
c+ insert into ibauthar
c+ (autable,aurfn1,autype,aucycle,auauthreq,auusrfn,audate,autxtran,
c+ aucethumb,ausign,auisasig,auusdid,auusfname,auusidno)
c+ (select
c+ autable,aurfn1,autype,aucycle,auauthreq,auusrfn,audate,autxtran,
c+ coalesce(aucethumb,' '), (case ausign
c+ when isnull then ' ' else ausign end),
c+ auisasig,auusdid,auusfname,auusidno
c+ from ibauthpf WHERE AUTABLE = 'KB' and AURFN1 = :KBRFN )
C/End-Exec
June 11, 2008 at 1:29 pm
it seems RPG does not recognise isnull or null at all. check my code.
C/Exec SQL
c+ insert into ibauthar
c+ (autable,aurfn1,autype,aucycle,auauthreq,auusrfn,audate,autxtran,
c+ aucethumb,ausign,auisasig,auusdid,auusfname,auusidno)
c+ (select
c+ autable,aurfn1,autype,aucycle,auauthreq,auusrfn,audate,autxtran,
c+ coalesce(aucethumb,' '), (case ausign
c+ when isnull then ' ' else ausign end),
c+ auisasig,auusdid,auusfname,auusidno
c+ from ibauthpf WHERE AUTABLE = 'KB' and AURFN1 = :KBRFN )
C/End-Exec
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply