Home » SQL & PL/SQL » SQL & PL/SQL » Need help
Need help [message #340017] Mon, 11 August 2008 01:11 Go to next message
world.apps
Messages: 70
Registered: January 2007
Location: Hyderabad
Member
Hi,

I am getting a problem from the following pl/sql block.

declare
 v_cusid number;
 v_addressid number;
 v_status varchar2(1);
 cursor c1 
 is select customer_name,balance,due_date, term
 from xx_data_conv;
 
 cursor c2(p_name varchar2(100))  
 is  select customer_id, address_id
 from xx_parties where customer_name = p_name;
begin
 for crow in c1 
  loop
   if crow.customer_name is not null then
     dbms_output.put_line(crow.customer_name);
    for vrow in c2(crow.customer_name)
     loop
       v_cusid:=vrow.customer_id;
       v_addressid:=vrow.address_id;
     end loop;
   else
    v_status:='E';
   end if;
  end loop;
end;

In above block I am getting customer name from cursor c1. That customer name also existing in xx_parties table but cursor c2 is retrieving null values. It is not matching the customer name from c1 with customer name from c2. But cursor c1 customer name is existing in xx_parties table.

I am not able to find the reason please help me in this.

Thanks in advance
Re: Need help [message #340020 is a reply to message #340017] Mon, 11 August 2008 01:21 Go to previous messageGo to next message
rajatratewal
Messages: 507
Registered: March 2008
Location: INDIA
Senior Member
you are not assigning value to p_name.

oh i missed that.

Paste your sqlplus session here.Exactly where you are getting the error.

Regards,
Rajat

[Updated on: Mon, 11 August 2008 01:23]

Report message to a moderator

Re: Need help [message #340021 is a reply to message #340020] Mon, 11 August 2008 01:27 Go to previous messageGo to next message
rajatratewal
Messages: 507
Registered: March 2008
Location: INDIA
Senior Member
String comparisions are case sensitive.

Rajat is not same as rajat.??

Sorry ignore my previous message that you are not assigning value to p_name.

For more clarification please paste your sqlplus session.

Regards,
Rajat

Re: Need help [message #340022 is a reply to message #340017] Mon, 11 August 2008 01:32 Go to previous messageGo to next message
Michel Cadot
Messages: 64131
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
I think you have oversimplify the actual procedure and problem as you don't output anything but customer_name, so I don't know how you can say something or other thing happened.

Regards
Michel
Re: Need help [message #340385 is a reply to message #340022] Tue, 12 August 2008 09:44 Go to previous message
world.apps
Messages: 70
Registered: January 2007
Location: Hyderabad
Member
Hi,

I found the problem I was running the code in different organization where this customer is not existing. Once I run this in the customer related organization it is working fine.

Thanks for your suggetions.
Previous Topic: Difference between HOST and BIND variables
Next Topic: Deferred Name Resolution
Goto Forum:
  


Current Time: Wed Dec 07 12:51:49 CST 2016

Total time taken to generate the page: 0.09464 seconds