Ct-bind adds spaces to character bind variables

Ct-bind adds spaces to character bind variables

Post by david rosn » Tue, 16 Apr 1996 04:00:00



I am using the client lib function ct_bind() to bind
   s_variable char[10]
to a result returned from a stored procedure. If the text that is
retrieved from the database is less than 10 characters, spaces are added
to the array.

example:
Stored procedure returns the value
      "astring"  - length 7
The array s_variable contains the value (after calling ct_fetch)
      "astring   " - length 10

When i bind the variable i specify CS_NULLTERM. Sorry if this is not
complete or perfect information, i have the code at work. Does anyone know
if this is normal ct-lib behavior? I can easily remove the extra spaces,
but i don't want to if i don't have to. thanks

-dave

--

             David M. Rosner      
             Digital Demographics, Inc.

 
 
 

Ct-bind adds spaces to character bind variables

Post by farahad.z.. » Wed, 17 Apr 1996 04:00:00


Quote:

> I am using the client lib function ct_bind() to bind
>    s_variable char[10]
> to a result returned from a stored procedure. If the text that is
> retrieved from the database is less than 10 characters, spaces are added
> to the array.

> example:
> Stored procedure returns the value
>       "astring"  - length 7
> The array s_variable contains the value (after calling ct_fetch)
>       "astring   " - length 10

>              David M. Rosner      

How are you defining "astring" in the stored proc? Is it char(10) or
varchar(10)? If it is defined as a char(10), Sybase will pad the
variable up and ct-library can do nothing about it. But presumably
you already know that :-)

We use ct-library extensively and haven't come across this problem.
May be you can post more info about the problem.

Cheers,
Farahad.

 
 
 

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. HELP... my BDE is eating all my memory !!!

3. shell variable into bind variable

4. Good Books

5. Q: variable number of pl/sql bind variable ?

6. IE5 Instability?

7. Setting a bind variable = script variable ??

8. pgsql/src/backend/utils/adt (oracle_compat.c)

9. How do I bind columns from several tables to one bound control in VB 5.0

10. To Bind or not to Bind ???

11. VB bound cltrs VS Delphi bound

12. Finding a record in a Bound recordset (bound using the DataEnvironment)

13. Data-Bound Vs. Non-Data-Bound Controls