Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: OCI V8 - Get Number of Placeholders
Jose Verissimo wrote:
>Martin Doherty <martin.doherty_at_nospam.com> wrote in message news:<ecKU9.19$G87.63_at_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
>>
>
>You're right Martin, but I'm still looking for the "teeth"
>description! ;)
>
>I'm looking for some OCI method/attribute that describes a placeholder
>just like the ODBC's "SQLDescribeParam" does...
>
>My application receives an "arbitrary" sql statement and it has to
>analyse it. If that sql statement has placeholders, it has to bind
>them with default values according to the datatype (those values can
>be changed later by using set methods that my application'll provide).
>So, before bind those placeholders, I would need to get, at least,
>their datatypes and the maximum sizes.
>
>Is this possible in OCI?!
>
>Jose Verissimo
>
I dont think there is any way to describe parameter ;(
You could try playing around with your SQL.
If you change insert into emp values ( :empno, :ename, :job, :sal,
:deptno )
to select * from emp where 1 = 0 ; and describe the results set you get the
types of your parameters.
If you think about it and try I recon you could cover most cases.
Having said that I dont think this is the answer you were looking for.
If any one has any better solutions I would love to hear thier ideas.
Cheers,
Stuart.
Received on Mon Jan 20 2003 - 11:12:54 CST