Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax for Passing a session variable to Oracle as a parameter

Status
Not open for further replies.

ajacode

Technical User
Aug 21, 2002
66
US
Using Visual Interdev for my ASP pages I have a recordset that uses a SQL string that returns a single column recordset for a dropdown box from Oracle 8i.

First I have captured the Session(LoginID") from a prior page,

Then in the Page onBeforeOpen I have it assigned to a variable ..
+++++++++++++++++++++++++++++++++++++++++++++++
<SCRIPT ID=serverEventHandlersVBS Language=vbscript RUNAT=SERVER>
dim usrLoginID

SUB usrStartFrm_onenter()

usrLoginID = Session(&quot;LoginID&quot;)

End SUB
</SCRIPT>
+++++++++++++++++++++++++++++++++++++++++++++++++
Then the REcorsdet loads using the following raw SQL statement
-------------------------------------------------
SELECT DISTINCT
L.LOGINID,
B.BUSINESSSEGMENTNAME
FROM
SODA.ASSIGNMENTS_TB A,
SODA.LOGINS_TB L,
SODA.BUSSEGMENT_TB B
WHERE
A.FK_LOGIN_NO = L.LOGIN_NO
AND
A.FK_BUSSEGID = B.BUSSEGID
+++++++++
Here is the Problem.....

AND (L.LOGINID = '&quot; & Session(&quot;LoginID&quot;)&quot;')

I can't get the syntax for Oracle to work.

If I use AND (L.LOGINID = 'bjones')

a literal then it works

But I cant pass either the actual session variable or a locally created variable.

I know the variable is there because it writes to the page when I response write it.

Could it be a timing issue ?

Any thought would be helpful

 
Here's how you do it (just missing an ampersand):

AND (L.LOGINID = '&quot; & Session(&quot;LoginID&quot;) & &quot;')
To err is human, but to really foul things up requires a computer.
- Farmers' Almanac, 1978

 
OOPS Sorry for incorrect Post.

Yes indeed I used both Ampersands


(L.LOGINID = '&quot; & Session(&quot;LoginID&quot;) & &quot;')

But it still does not work.

I don't get any errors but I get a null set.

IS the ON enter sub creating the variable before the REcordset is created?

I thought perhaps not that's why I just used the Session(&quot;LoginID&quot;) which I KNOW is good.

Thanks for your quick reply and I still need more work to make this work
 
Try Response.Write to view your SQL statement prior to sending it to Oracle.
To err is human, but to really foul things up requires a computer.
- Farmers' Almanac, 1978

 
I do that already, it's just getting the syntax for Oracle to be happy and return me records.

I response wite both the Session variable and the new page variable holding the Sesison variable....

This is a perfect example of the war between Oracle and MS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top