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
mousemat24Asked:
Who is Participating?
 
sybeCommented:
Your question is a bit unclear to me.

> I have a function in Oracle
Do you mean a stored procedure?

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

That does not look like a function or stored procedure to me. As an SQL statement it also seems a bit strange to me. Especially it is not clear to me from which table you are selecting.

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

Command parameters are used mostly (only) in correspondence with the parameters of a stored procedure.

So you question is confusing me. Could you give some additional information?



0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.