Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ORA-01008 Issue in ADBC SQL

Former Member
0 Likes
953

Hi All,,

I am getting an "ORA-01008: not all variables bound" error message when I execute this line "nbr_of_rows = rs_obj->next_package( )." in the code below. Could anyone tell me why I am getting this error and what I can do to solve it.

Many thanks,

Points Awarded,

Colm


  TYPES: BEGIN OF ty_doctaba,
          f_docnumber TYPE n LENGTH 10,
          f_docclassnumber TYPE n LENGTH 5,
          a38 TYPE c LENGTH 239,
          END OF ty_doctaba.

  DATA:   f3 TYPE ty_doctaba-f_docclassnumber VALUE  '7',
          f5 TYPE ty_doctaba-A38 VALUE IS INITIAL,
          f4 TYPE ty_doctaba-f_docnumber.

  DATA t_doctaba TYPE TABLE OF ty_doctaba WITH HEADER LINE.

    DATA: stmt_obj TYPE REF TO cl_sql_statement,
          rs_obj TYPE REF TO cl_sql_result_set,
          itab_ref TYPE REF TO data,
          doc_tab TYPE TABLE OF ty_doctaba,
          nbr_of_rows TYPE i.

    DATA: con_obj TYPE REF TO cl_sql_connection.
    DATA: lr_cxsql TYPE REF TO cx_sql_exception.

    TRY.
        con_obj = cl_sql_connection=>get_connection( 'NETFILE' ).
      CATCH cx_sql_exception INTO lr_cxsql.
    ENDTRY.

    stmt_obj = con_obj->create_statement( ).

    TRY.
    rs_obj = stmt_obj->execute_query( 'SELECT F_DOCNUMBER, A38 FROM doctaba WHERE F_DOCCLASSNUMBER = :F3 AND F_DOCNUMBER > :F4 AND A38 <> :F5' ).
      CATCH cx_sql_exception INTO lr_cxsql.
    ENDTRY.

    GET REFERENCE OF doc_tab INTO itab_ref.
    rs_obj->set_param_table( itab_ref ).

    break cgavin.
    TRY.
        nbr_of_rows = rs_obj->next_package( ). "ERROR HAPPENS HERE
      CATCH cx_sql_exception INTO lr_cxsql.
    ENDTRY.
    rs_obj->close( ).

Hi All,,

I am getting an "ORA-01008: not all variables bound" error message when I execute this line "nbr_of_rows = rs_obj->next_package( )." in the code below. Could anyone tell me why I am getting this error and what I can do to solve it.

Many thanks,

Points Awarded,

Colm


  TYPES: BEGIN OF ty_doctaba,
          f_docnumber TYPE n LENGTH 10,
          f_docclassnumber TYPE n LENGTH 5,
          a38 TYPE c LENGTH 239,
          END OF ty_doctaba.

  DATA:   f3 TYPE ty_doctaba-f_docclassnumber VALUE  '7',
          f5 TYPE ty_doctaba-A38 VALUE IS INITIAL,
          f4 TYPE ty_doctaba-f_docnumber.

  DATA t_doctaba TYPE TABLE OF ty_doctaba WITH HEADER LINE.

    DATA: stmt_obj TYPE REF TO cl_sql_statement,
          rs_obj TYPE REF TO cl_sql_result_set,
          itab_ref TYPE REF TO data,
          doc_tab TYPE TABLE OF ty_doctaba,
          nbr_of_rows TYPE i.

    DATA: con_obj TYPE REF TO cl_sql_connection.
    DATA: lr_cxsql TYPE REF TO cx_sql_exception.

    TRY.
        con_obj = cl_sql_connection=>get_connection( 'NETFILE' ).
      CATCH cx_sql_exception INTO lr_cxsql.
    ENDTRY.

    stmt_obj = con_obj->create_statement( ).

    TRY.
    rs_obj = stmt_obj->execute_query( 'SELECT F_DOCNUMBER, A38 FROM doctaba WHERE F_DOCCLASSNUMBER = :F3 AND F_DOCNUMBER > :F4 AND A38 <> :F5' ).
      CATCH cx_sql_exception INTO lr_cxsql.
    ENDTRY.

    GET REFERENCE OF doc_tab INTO itab_ref.
    rs_obj->set_param_table( itab_ref ).

    break cgavin.
    TRY.
        nbr_of_rows = rs_obj->next_package( ). "ERROR HAPPENS HERE
      CATCH cx_sql_exception INTO lr_cxsql.
    ENDTRY.
    rs_obj->close( ).

5 REPLIES 5
Read only

Former Member
0 Likes
826

Just in case in makes any difference we are on SAP Release 620

Read only

Former Member
0 Likes
826

Anyone have any ideas?

Read only

Former Member
0 Likes
826

I resolved this issue myself. For the answer please message me.

Read only

Former Member
0 Likes
826

Hi

Mr.Colm Gavin,

I've got a requirement werein i need to export certain condition type data for vk13 transaction in to web......I've got no idea about abap database connecitity(ADBC) functionality here and its use please help me in giving me the sample coding of how to use this functionality to proceed further...more over i've worked on abap for long time but i'm always new to java concepts and never used class and method approach of programming in abap...so any one who has worked with this functionality please comeup with sample coding or atleast about this concepts of programming..........

Read only

0 Likes
826

FORM connectdb .

*Connect to the Oracle database FILENET which is set up by the BASIS

*team in the DBCON table

TRY.

con_obj = cl_sql_connection=>get_connection( 'FILENET' ).

CATCH cx_sql_exception INTO lr_cxsql.

MESSAGE 'Error Connecting to the Database' TYPE 'E'.

ENDTRY.

*Create a statement object

stmt_obj = con_obj->create_statement( ).

*Build the SQL statement using the variables that have been populated

CONCATENATE 'SELECT F_DOCNUMBER,'

'F_DOCCLASSNUMBER, A38 '

'FROM DOCTABA WHERE F_DOCCLASSNUMBER = '

f_docclassnumber

'AND F_DOCNUMBER > '

f_docnumber

'AND A38 IS NOT NULL'

INTO sql SEPARATED BY space.

*Store the SQL statement in the value rs_obj container

TRY.

rs_obj = stmt_obj->execute_query( sql ).

CATCH cx_sql_exception INTO lr_cxsql.

MESSAGE 'Error in populating SQL statement' TYPE 'E'.

ENDTRY.

*Assign the structure of doctaba to the reference varible itab_ref and

*store that into the rs_obj container

GET REFERENCE OF doctaba INTO itab_ref.

rs_obj->set_param_table( itab_ref ).

*Exectute the SQL statement and store the results in the doctaba

*table. nbr_of_rows stores the record count.

TRY.

nbr_of_rows = rs_obj->next_package( ).

CATCH cx_sql_exception INTO lr_cxsql.

MESSAGE 'Error in SQL statement' TYPE 'E'.

ENDTRY.

*Close the connection to the Oracle database.

rs_obj->close( ).

ENDFORM. " CONNECTDB