Call a parameterized Oracle query from ADODB in Classic ASP

前端 未结 1 1413
粉色の甜心
粉色の甜心 2021-01-13 02:08

I’m currently working on a classic ASP project talking to an Oracle database. I’m trying to find a way to safely call an Oracle PL/SQL script and passing parameters with AD

相关标签:
1条回答
  • 2021-01-13 02:31

    How do you have filter_value defined? If it's not declared as a String or if you've assigned a string longer than 10 characters (as you've indicated when creating the parameter), you'll have issues with that.

    Additionally (and partly for my own reference), named parameters are not supported via OraOLEDB (i.e. ADODB).

    See Oracle® Provider for OLE DB Developer's Guide 11g Release 1 (11.1) or follow the "Command Parameters" heading link on any of the previous versions (8iR3, 9i, 9iR2, 10g, 10gR2):

    Command Parameters

    When using Oracle ANSI SQL, parameters in the command text are preceded by a colon. In ODBC SQL, parameters are indicated by a question mark (?).

    OraOLEDB supports input, output, and input and output parameters for PL/SQL stored procedures and stored functions. OraOLEDB supports input parameters for SQL statements.

    "Note: OraOLEDB supports only positional binding."

    That said, this should have no bearing on your query when using OraOLEDB:

    oFilteredList.NamedParameters = True
    

    I've had success running queries exactly as the rest of your example shows though on Oracle 10gR2.

    You don't show your connection string, so I must assume it to be valid. Behavior can differ depending on options there, so here's what I successfully use:

    `"Provider=OraOLEDB.Oracle;Data Source=TNSNAMES_ENTRY;User ID=XXXX;Password=YYYY;DistribTx=0;"`
    
    0 讨论(0)
提交回复
热议问题