View previous topic :: View next topic
|
Author |
Message |
jayaramreddy.r
New User
Joined: 20 Aug 2005 Posts: 5 Location: hyderabad
|
|
|
|
Hi ALL,
I have declared a cursor which looks like
Declare c1 cursor for
select A1,A2,A3
.
.
unoin
Select A1 B2 A3
.
.
Here A1, A3 are from same tables and A2, B2 are from different tables.
Now i want to know during fetch how should i declare.
I declare has fetch
in to :A1,:A2,:A3,:A4
is it correct or please correct me
As it is uion for every fetch it will have only 3 columns.
Thanks
JR |
|
Back to top |
|
|
radhakrishnan82
Active User
Joined: 31 Mar 2005 Posts: 435 Location: chennai, India
|
|
|
|
As it will return one record per fetch,
Fetch
into
:A1
:A2
:A3
is correct.the same is used in our shop. |
|
Back to top |
|
|
radhakrishnan82
Active User
Joined: 31 Mar 2005 Posts: 435 Location: chennai, India
|
|
|
|
now i got you Q.
I think it can't be used like that even if A2 and B2 are of same data type.It will return only 3.
If A2 and B2 are of different data type then UNION itself cant be used. |
|
Back to top |
|
|
jayaramreddy.r
New User
Joined: 20 Aug 2005 Posts: 5 Location: hyderabad
|
|
|
|
jayaramreddy.r wrote: |
jayaramreddy.r wrote: |
Hi ALL,
I have declared a cursor which looks like
Declare c1 cursor for
select A1,A2,A3
.
.
unoin
Select A1 B2 A3
.
.
Here A1, A3 are from same tables and A2, B2 are from different tables.
Sorry
i declare has fetch into
:A1,:A2,:A3,:B2
at every fetch one record into
a1,a3 and b2 or a2
let me know
regards
Jr
Now i want to know during fetch how should i declare.
I declare has fetch
in to :A1,:A2,:A3,:A4
is it correct or please correct me
As it is uion for every fetch it will have only 3 columns.
Thanks
JR |
|
Hi RK
Then please let me know how to declare fetch.
i declared as
Fetch
A1,A2,A3,B2
at time it will fetch A1,A3, and B2 or A2
i mean for every fetch there will three colums only and one colums will be spaces is it works
let me know
thanks
jayaram |
|
Back to top |
|
|
atik
New User
Joined: 29 Jul 2005 Posts: 20
|
|
|
|
HI,
You are using Union means the column nos should be same. while fetching you are bothered about the number of columns not the table from which the data is coming. SO use 3 host variables. |
|
Back to top |
|
|
harinatha
New User
Joined: 24 Jul 2005 Posts: 28
|
|
|
|
Hi,
I agree with atik. What he is saying is correct.
Thanks & Regards,
Hari. |
|
Back to top |
|
|
jayaramreddy.r
New User
Joined: 20 Aug 2005 Posts: 5 Location: hyderabad
|
|
|
|
harinatha wrote: |
Hi,
I agree with atik. What he is saying is correct.
Thanks & Regards,
Hari. |
But how can i differenciate A2 or B2 to write in to file
regards
jr |
|
Back to top |
|
|
|