View previous topic :: View next topic
|
Author |
Message |
kvivek
New User
Joined: 09 May 2005 Posts: 51 Location: Singapore
|
|
|
|
Hi All,
I faced a strange problem in select query. In my program I tried to select all the columns from a particular table in the order other than the table's column sequence.
For example Table1 is defined with the following column sequence Var1, Var2 , Var3 and my selection order is Va2, Var1, Var3. During execution Value of Var1 is moved to Var2 and Value of Var2 is moved to Var1. (which is the table's column sequence). In INTO I have given the dclgen variables in the selection order only(i.e. DCLVar2, DCLVar1 and DCLVar3).
Table has around 60 columns. This happens only if i select all the fields and I tried selecting some of the fields (In different order) and got the proper result.
What could be the reason for this? Is this due to Installation problem??
Thanks,
Vivek |
|
Back to top |
|
|
jayesh_g
New User
Joined: 03 Mar 2004 Posts: 23
|
|
|
|
Well......did you use
Code: |
SELECT VAR2, VAR1, VAR3 INTO :DCLVAR2, :DCLVAR1, :DCLVAR3 |
or
Code: |
SELECT * INTO :DCLVAR2, :DCLVAR1, :DCLVAR3 |
? |
|
Back to top |
|
|
parikshit123
Active User
Joined: 01 Jul 2005 Posts: 269 Location: India
|
|
|
|
jayesh,
I think,
is not a solution
SELECT VAR2, VAR1, VAR3 INTO :DCLVAR2, :DCLVAR1, :DCLVAR3
or
Coding SELECT * INTO :DCLVAR2, :DCLVAR1, :DCLVAR3
both are same if var1,var2 and var3 are the only attributes in the relation.
There might be something else wrong.
Vivek, Can you give the exact SQL statement you issued? |
|
Back to top |
|
|
gvt460
New User
Joined: 04 Mar 2005 Posts: 23
|
|
|
|
vivek u should give like this
SELECT VAR2, VAR1, VAR3 INTO :DCLVAR2, :DCLVAR1, :DCLVAR3
or
Coding SELECT * INTO :DCLtablename
if i am wrong let me know.
byee
venkatesh. |
|
Back to top |
|
|
kvivek
New User
Joined: 09 May 2005 Posts: 51 Location: Singapore
|
|
|
|
Hi parikshit123,
I have issued the following statement
Code: |
SELECT VAR2, VAR1, VAR3 INTO :DCLVAR2, :DCLVAR1, :DCLVAR3 |
I have received the values in the order of table declaration. Let's say VAR1 is 3 bytes, VAR2 is 4 bytes and VAR3 is 2 bytes. In my output i received like this
Code: |
DCLVAR2 = VAR1(3) + VAR2(1)
DCLVAR1 = VAR2(2:3)
DCLVAR3 = VAR3 |
This happens only if i select all the fields (Around 60 fields, jayesh_g I never use Select * in my program )
If I select some of the fields (I tried upto 10 fields), It was working fine irrespective of the order of selection.
I guess this is due to Installation problem, Please let me know if you come across this type of error.
Thanks,
Vivek |
|
Back to top |
|
|
somasundaran_k
Active User
Joined: 03 Jun 2003 Posts: 134
|
|
|
|
Vivek
Sound interesting.
Can you please post the SQL query (exactly as in your program) ?
Regds
-Som |
|
Back to top |
|
|
kvivek
New User
Joined: 09 May 2005 Posts: 51 Location: Singapore
|
|
|
|
Hi somasundaran_k,
Due to data security I could not send the exact query. Please let me know if you have any queries, I will try to explain as much as possible. I am sorry for not sending you the exact code.
Thanks,
Vivek |
|
Back to top |
|
|
mayaganesh Warnings : 1 New User
Joined: 07 Jul 2005 Posts: 1
|
|
|
|
Hi Guies,
I want to find the forth max value in the table. pls send the query.
thanks |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
Back to top |
|
|
|