Re: DECODE Question again

From: Thomas J. Kyte <tkyte_at_us.oracle.com>
Date: 1996/11/07
Message-ID: <32820320.4153222_at_dcsun4>#1/1


On 7 Nov 1996 04:33:18 GMT, Systems Admin <sysadmin_at_doj.vic.gov.au> wrote:

>Sorry, a bit of the message was left off, try again:
>
>I have a column called DISK_NAME which is a VARCHAR2(22).
>It contains data in the following form:
>
>DISK_NAME
>----------------------
>(dgsc(vme(0),1,7),0,0)
>(dgsc(vme(0),1,7),0,1)
>(dgsc(vme(0),1,7),0,2)
>(dgsc(vme(0),1,7),0,3)
>(dgsc(vme(0),1,7),0,4)
>(dgsc(vme(0),1,7),0,0)
>(dgsc(vme(0),1,7),0,1)
>(dgsc(vme(0),1,7),0,2)
>(dgsc(vme(0),1,7),0,3)
>(dgsc(vme(0),1,7),0,4)
>(dgsc(vme(0),1,7),0,0)
>
>I want to load this with SQL*Loader and want to decode it before it
>hits the table, so I tried this in the CTL file :
>
>disk_name position(33:40) CHAR
> decode('disk_name','(dgsc(vme(0),1,7),0,4)','sdisk174')
>
>
>However, although the LOG file shows no errors, the column is empty
>when I do a select from the table. If I put 'xxx' after the 'sdisk174'
>in the CTL file, this gets loaded ok.
>Also, if I load the data in the original form, when I do a
>

That's cause it is comparing the constant 'disk_name' to the constant '(dgsc(vme(0),1,7),0,4)'. You want:

disk_name position(33:40) CHAR
 "decode(:disk_name,'(dgsc(vme(0),1,7),0,4)','sdisk174')"

So that it compares the bind variable disk_name to the constant.

>SELECT
> DECODE('disk_name','(dgsc(vme(0),1,7),0,4)','sdisk174')
>FROM diskstats;
>
>It also shows an empty column.
>
>What am I missing?
>
>Thanks,
>
>Andy Horne
>

Thomas Kyte
Oracle Government
tkyte_at_us.oracle.com                          

http://govt.us.oracle.com

  • Check out Oracle Governments web site! ----- Follow the link to "Tech Center" and then downloadable Utilities for some free software...

statements and opinions are mine and do not necessarily reflect the opinions of Oracle Corporation Received on Thu Nov 07 1996 - 00:00:00 CET

Original text of this message