Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: OCI V8 - Get Number of Placeholders

Re: OCI V8 - Get Number of Placeholders

From: Martin Doherty <martin.doherty_at_nospam.com>
Date: Mon, 13 Jan 2003 17:55:53 -0800
Message-ID: <ecKU9.19$G87.63@news.oracle.com>


Applying a bit of lateral thinking .... could you just loop through the string containing your SQL statement and count the colons?

I'm reminded of the parable of the group of Greek philosophers who were trying to deduce, by logical argument, how many teeth a horse had, when a passing Arab (overhearing their heated debate) slipped into a nearby barn and returned moments later to announce the correct answer, having gone and counted them.

Martin Doherty

Jose Verissimo wrote:

>Kevin English <kenglish_at_4csoftware.com> wrote in message news:<lhm52vgqm13gcheoet2f2p6a7a8le9i1k3_at_4ax.com>...
>
>
>>On 13 Jan 2003 04:07:15 -0800, jose.verissimo_at_tie.co.pt (Jose
>>Verissimo) wrote:
>>
>>
>>
>>>Hello all!
>>>
>>>Does anyone know if there is a way to get the number of placeholders
>>>
>>>
>>>from a sql statement?
>>
>>
>>>For instance, if I have the following sql statement:
>>>"INSERT INTO emp VALUES (:empno, :ename, :job, :sal, :deptno)"
>>>is there any method/attribute that can give me the number of
>>>placeholders (5) after this satement has been prepared
>>>(OCIStmtPrepare)?
>>>
>>>Thanks,
>>>Jose Verissimo
>>>
>>>
>>Hi,
>>Although this does not do exactly what you ask for, it may be
>>adequate. Try:
>>
>>OCIStmtExecute(...,OCI_DESCRIBE_ONLY);
>>OCIAttrGet(...,OCI_ATTR_PARAM_COUNT,...);
>>Then loop with multiple calls to
>>OCIParamGet(...,OCI_HTYPE_STMT,...);
>>(This is from Oracle Call Interface Programmers Guide, Appendix A)
>>
>>Hope this helps.
>>Cheers
>>Kevin English
>>
>> Posted Via Usenet.com Premium Usenet Newsgroup Services
>>----------------------------------------------------------
>> ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
>>----------------------------------------------------------
>> http://www.usenet.com
>>
>>
>
>Hi Kevin!
>
>Thanks for you reply, but I'm afraid that won't do what I'm looking
>for... The sequence of commands you've suggested describes a Select
>List and I was looking for some kind of methods that would describe
>the placeholders.
>In ODBC we have those methods (SQLNumParams and SQLDescribeParam) but
>I could not find anything similar in OCI...
>
>Does anyone know if they exist?
>
>Thanks,
>Jose Verissimo
>
>
Received on Mon Jan 13 2003 - 19:55:53 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US