bind variables in OCI select

bind variables in OCI select

Post by mark tomlins » Wed, 06 May 1998 04:00:00



Forget the INTO clause - that is PLSQL/Pro*C specific, jsut use the
SQL:

select col1 from my_table where <whatever>

and bind the variables/select list items...

 
 
 

1. OCI: Binding collections (varray), Ora 1008: not all variables bound

Hi,
I,ve got a stored procedure, which takes a varray as parameter:

create or replace type tp_person as object
(
        pid             number,
        name            varchar2(20),
        vorname         varchar2(20),
        strasse         varchar2(20),
        ort             varchar2(20),
);
/
create or replace type va_person AS varray(100) of tp_person;  
/
procedure list(person out va_person) is
begin
        select
                cast(multiset(
                        select value(tb)
                        from ov_person tb)
                        as va_person)
                into
                        person
                from
                        dual;
end;
/ (Thanks to T.Kyte)

Now I want to call this procedure from an OCI program:

static text *listStmtTxt = (text *) "BEGIN\
                                        pkg_person.list(:DATA);\
                                        END;";

OCIStmtPrepare(...)
OCIDefineByPos(...,(ub4)1,...)
OCIDescribeAny(...)
OCIAttrGet(..., (ub4) OCI_HTYPE_DESCRIBE,..., (ub4)OCI_ATTR_PARAM,...)
OCIAttrGet(..., (ub4) OCI_DTYPE_PARAM,... (ub4)OCI_ATTR_REF_TDO,...)
OCIObjectPin(...)

OCIDefineObject(...)
OCIDefineArrayOfStruct(...)

OCIStmtExecute(...) returns "Ora 1008: not all variables bound".

Who knows, what I forgot.
Does anybody have a chunk of sample code for this purpose?

TIA,
Joerg Blaese

2. Informix on SUN vs HP

3. re-binding variables in OCI statements

4. discover nodes en oms con cluster

5. OCI Bind/ SQL Select problem, Oracle8

6. FileMaker Now Security Update

7. OCI - placeholders and BIND to INSERT & SELECT

8. How to use adox to copy a table from a *.mdb to another.

9. OCI: binding arrays in select statements?

10. ASP - ORACLE - select statement with bind variables

11. OCI: Anything special about selecting ROWID with OCI?

12. Ct-bind adds spaces to character bind variables

13. shell variable into bind variable