Skip to Content
0
Former Member
Jul 11, 2008 at 12:28 PM

EXEC SQL: DESCRIBE of an External Table

340 Views

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?