Skip to Content
author's profile photo Former Member
Former Member

How to get field names of external db table

Hello,

is there a way how to get field names of external db table?

i have external db (Oracle) connected like this but i don't have field names of table i want to read and have no other way how to get it since my coleague is off.

exec sql.

Connect to : db_con_gis

endexec.

exec sql.

set connection: db_con_gis

endexec.

Thank you

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Jul 21, 2016 at 01:53 PM

    You can take help from cl_sql_connection & cl_sql_result_set to get this. Example code to display the list of fields with their types are given below. I tried it in my system, and it works for me.

    data: dbconn type ref to cl_sql_connection,

    results type ref to cl_sql_result_set,

    error type ref to cx_root.

    parameters: p_table type char10 obligatory,

    p_conn type dbcon_name obligatory.

    try.

    dbconn = cl_sql_connection=>get_connection( p_conn ).

    results = dbconn->create_statement( )->execute_query( |SELECT * FROM { p_table }| ).

    cl_demo_output=>display( results->get_metadata( ) ).

    dbconn->close( ).

    catch cx_root into error.

    message error->get_text( ) type 'S'.

    if dbconn is not initial.

    dbconn->close( ).

    endif.

    endtry.


    Thanks,

    Juwin

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 21, 2016 at 09:06 AM

    There are tables in Oracle that contains this information, look at ALL_TAB_COLUMNNS.

    Regards,

    Raymond

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 21, 2016 at 08:23 AM

    Hi

    I usually uses TOAD Toad for Oracle | Oracle Database Tools | SQL Development & Administration | Dell Software

    There's a trial version you can try to use it

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.