Application Development 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: 

EXEC SQL: DESCRIBE of an External Table

Former Member
0 Kudos

Hello,

I try to get a description of the all the fields of an (external) oracle table but I'm no to happy yet.

"SELECT" to this oracle connection work but I can't use "DESC"-command successful.

The report looks like this:

.REPORT z_desc_ext_table.

DATA: wa(500) TYPE c.

DATA: dbcon_name(30) TYPE c VALUE 'PDMQ' . "Name in DBCO


START-OF-SELECTION.

  EXEC SQL.
    SET CONNECTION :dbcon_name
  ENDEXEC.
  EXEC SQL.
    connect to :dbcon_name
  ENDEXEC.


  EXEC SQL.
    open c for
    desc table.in.oracle.
  ENDEXEC.


  DO.
    EXEC SQL.
      fetch next c into :wa
    ENDEXEC.
    IF sy-subrc <> 0.
      EXIT.
    ENDIF.
    WRITE: / wa.
  ENDDO.


  EXEC SQL.
    disconnect :dbcon_name
  ENDEXEC.

.

When the report is executed the following dump is produced:

...

Database error text........: "ORA-00900: invalid SQL statement"

Triggering SQL statement...: "FETCH NEXT "

Internal call code.........: "[DBDS/NEW DSQL]"

...

000300 DO.

000310 EXEC SQL.

> fetch next c into :wa

000330 ENDEXEC.

000340 IF sy-subrc <> 0.

000350 EXIT.

000360 ENDIF.

...

Does anyone have an idea how to make this work?

2 REPLIES 2

JanStallkamp
Employee
Employee
0 Kudos

Hello.

I would suggest asking this question in the 'SAP on Oracle' forum. What I would suggest anyway is to use ADBC instead of EXEC SQL. But that is my personal preference as it is object oriented and in my eyes easier to use.

Best regards,

Jan Stallkamp

Former Member
0 Kudos

Thanks I started a new Thread here: