Link to home
Start Free TrialLog in
Avatar of mousemat24
mousemat24

asked on

How to bind variables in Oracle using classic ASP

Hi there

Wonder if you can help me?

I'm using classic ASP (Javascript), I have a function in Oracle, and I want to bind my variables to the SELECT statement.

This is what I have currently

strSQL = "SELECT First_Name, Last_Name, REPLACE(Phone, ' ', '') AS Phone, TCOUNT FROM TABLE(MYPKG.MY_PAGEINATION('" + last.toUpperCase() +  "%', '" + first.toUpperCase() + "%' , NULL, " + start + ", " + end + "))";

How to I get this to work with bidning my variables.

I've done something like this, but not too sure if its correct?

var oCmd = Server.CreateObject("ADODB.Command");
oCmd.ActiveConnection = connSt;

var ln1 = oCmd.CreateParameter("P_LASTNAME", 200, 1, 30, last.toUpperCase())
oCmd.Parameters.Append ln1

var fn1 = oCmd.CreateParameter("P_LASTNAME", 200, 1, 30, first.toUpperCase())
oCmd.Parameters.Append fn1

var pn1 = oCmd.CreateParameter("P_PHONE", 200, 1, 30, "")
oCmd.Parameters.Append pn1

var lo = oCmd.CreateParameter("P_LOWNUM", 200, 1, 30, "")
oCmd.Parameters.Append lo

var hi = oCmd.CreateParameter("P_HINUM", 200, 1, 30, "")
oCmd.Parameters.Append hi

Thanks
Mousemat24
ASKER CERTIFIED SOLUTION
Avatar of sybe
sybe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial