Link to home
Create AccountLog in
Avatar of bhsdba50
bhsdba50Flag for United States of America

asked on

creating a view

I have to create a view to be used as a export.  The target has columns not contained in the source. How do I reference and define the space without the column name? NOTE -- Means no column_name in table.

select RPAD(REC,2,'I') REC,
       RPAD(SUPP,8,' ')SUPP,
       RPAD(INVOICE,12,' ') INVOICE,
       TO_CHAR(IDATE, 'MM/DD/RR') IDATE,
       TO_CHAR(DDUE, 'MM/DD/RR') DDUE,
       RPAD(ICAMNT,12,' ') ICAMNT,
       --RPAD(NVL(SEP_CHK_CODE,1,'N') SEP_CHECK_CODE,
       RPAD(NVL(OREF,15,' ') OREF,
       RPAD(ICHRG,12,' ') ICHRG
       RPAD(NVL(NUM,'0'),68,' '),
        --   RPAD(NVL(IMPTFR,'M'),11,' ')
      from <table_name>;
Avatar of Sean Stuber
Sean Stuber

just create an alias

select RPAD(REC,2,'I') REC,
       RPAD(SUPP,8,' ')SUPP,
       RPAD(INVOICE,12,' ') INVOICE,
       TO_CHAR(IDATE, 'MM/DD/RR') IDATE,
       TO_CHAR(DDUE, 'MM/DD/RR') DDUE,
       RPAD(ICAMNT,12,' ') ICAMNT,
       NULL  some_column,
       RPAD(NVL(SEP_CHK_CODE,1,'N') SEP_CHECK_CODE,
       RPAD(NVL(OREF,15,' ') OREF,
       RPAD(ICHRG,12,' ') ICHRG
       RPAD(NVL(NUM,'0'),68,' '),
       NULL some_other_column,
       RPAD(NVL(IMPTFR,'M'),11,' ')
      from <table_name>;
Avatar of bhsdba50

ASKER

How do I define the spce needed?  NULL (BCOLUMN ,4,' ')    ?????
ASKER CERTIFIED SOLUTION
Avatar of Sean Stuber
Sean Stuber

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account