[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1306
  • Last Modified:

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
0
mousemat24
Asked:
mousemat24
1 Solution
 
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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now