Home » SQL & PL/SQL » SQL & PL/SQL » validation
validation [message #267772] Fri, 14 September 2007 15:22 Go to next message
vamcs
Messages: 20
Registered: June 2007
Location: somerset
Junior Member

Hi,
I have the data file which has customer_class_code has values a and b and site_use_code and primary_site_use_flag columns not found in the data file.
business need is if customer class code is 'a' than insert site_use_code is bill_to and primary_site_use_flag is bill_to.if customer class code is b insert site_use_code bill_to and ship_to and the primary_site_use_flag is ship_to.
how can i do this can any one help me to build the logic if orig_system_address_ref column is not given.

Thanks in advance
Re: validation [message #268036 is a reply to message #267772] Mon, 17 September 2007 05:07 Go to previous messageGo to next message
scorpio_biker
Messages: 154
Registered: November 2005
Location: Kent, England
Senior Member
I'm not quite sure I follow you?

Do you mean something along the lines of
if customer class code = a then
   insert into table (site_use_code, primary_site_use_flag)
          values (bill_to, bill_to);
elsif customer class code = b then
   insert into table (site_use_code, primary_site_use_flag)
          values (ship_to, ship_to);
end if;


And how does orig_system_address_ref fit into it?

Perhaps you could show us what you've already tried?
Re: validation [message #268059 is a reply to message #267772] Mon, 17 September 2007 07:00 Go to previous message
Aalap
Messages: 4
Registered: September 2007
Location: India
Junior Member
Another way of doing the same thing:

insert into table
(site_use_code, primary_site_use_flag)
values
(decode(customer_class_code ,'a',bill_to,'b',ship_to),
decode(customer_class_code ,'a',bill_to,'b',ship_to)
);

Cheers Smile
Previous Topic: Help in writing function.. regarding parameters of function
Next Topic: Function to return Nested Table
Goto Forum:
  


Current Time: Sat Dec 03 10:03:55 CST 2016

Total time taken to generate the page: 0.23060 seconds