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: opposite of oracle decode

Re: opposite of oracle decode

From: Adam Sandler <corn29_at_excite.com>
Date: 6 Oct 2005 06:41:17 -0700
Message-ID: <1128606077.300957.259440@g44g2000cwa.googlegroups.com>

Doug wrote:
> Adam Sandler wrote:
> > My question is what if I want to write to the DB? If the user is using
> > a GUI to interface with the DB and they see open, review, or closed in
> > the GUI's list of options, I need to trnaslate open, review, or closed
> > into 1, 2, or 3 to get it into the DB.
> >
>
> Well, if you use SELECT DECODE(your_column, 1, 'OPEN', 2, 'REVIEW', 3,
> 'CLOSED') to query the data, why not just use UPDATE SET your_column =
> DECODE(your_value, 'OPEN', 1, 'REVIEW', 2, 'CLOSED', 3)?
>
> If you're working with DECODE a bit, you might find this useful -
> http://doug.burns.tripod.com/decode.html
>
> Cheers,
>
> --
> Doug Burns - Oracle DBA
>
> dougburns_at_yahoo.com
>
> http://doug.burns.tripod.com
> http://oracledoug.blogspot.com

Doug... thanks for the reply. I have a follow-up question. Isn't UPDATE SET dependent upon the data already existing? If the GUI sends this to the data access layer

INSERT INTO T_TEST (Status) VALUES 'Open'

won't I get an error? The status column is set to hold 1 char. If I send "Open" to a new row, that busts the properties of the status column. Received on Thu Oct 06 2005 - 08:41:17 CDT

Original text of this message

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