Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Inserts with different conditions in pl/sql

Re: Inserts with different conditions in pl/sql

From: <G.Plivna_at_itsystems.lv>
Date: Tue, 13 Nov 2001 02:21:27 -0800
Message-ID: <F001.003C31F5.20011113015518@fatcity.com>

INSERT INTO target_table (target_column) SELECT decode(source_column, '?', 98, 'X', NULL, source_column) FROM source_table;

  1. This isn't pl/sql, just pure insert statement
  2. If datatype of target_column is Number You cannot insert 'Missing info' in this column, use NULLs instead
  3. If You don't know what decode does look into docs

Gints Plivna
IT Sistēmas, Merķeļa 13, LV1050 Rīga
http://www.itsystems.lv/gints/

                                                                                       
                            
                    Roland.Skoldbl                                                     
                            
                    om_at_ica.se            To:     Multiple recipients of list ORACLE-L 
<ORACLE-L_at_fatcity.com>       
                    Sent by:             cc:                                           
                            
                    root_at_fatcity.c       Subject:     Inserts with different 
conditions in pl/sql                  
                    om                                                                 
                            
                                                                                       
                            
                                                                                       
                            
                    2001.11.13                                                         
                            
                    10:20                                                              
                            
                    Please respond                                                     
                            
                    to ORACLE-L                                                        
                            
                                                                                       
                            
                                                                                       
                            




Hallo,

How can I write in a pl/sql block if I want to do an insert from one table to another
 table and at the same time translate the value '?' to 98 and the value 'X' to 'Missing info'
Both those values can exist in the first table. The datatyupe in table one is varchar2 and in table two it is numberdatatype.

Please help me.

Thanks in advance.

Roland S

--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author:
  INET: Roland.Skoldblom_at_ica.se

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists

--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).

--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author:
  INET: G.Plivna_at_itsystems.lv

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists

--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Tue Nov 13 2001 - 04:21:27 CST

Original text of this message

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