Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2006
    Posts
    2

    Unanswered: NEED Help .... SQL *plus command

    Hi all,

    I am not sure if this is the right place to put my question.

    I wanna to know how can I embedded/execute SQL *Plus command in java code since it is not same to SQL command ? e.g. i want to execute the (DESC
    command).

    I appreciate any help.

    Regards,


    ONE1

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    Do it the same why you would execute any other OS command/executable.
    This is a JAVA problem & not an Oracle issue.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Mar 2006
    Posts
    2
    It is related to orcale and java .. think so

    What do you mean by [Do it the same why you would execute any other OS command/executable.]

  4. #4
    Join Date
    Sep 2004
    Location
    London, UK
    Posts
    565
    SQL*Plus is a command-line application. That's it. There is no fancy interface to access its functionality, you have to start it up and capture the output.

    Possibly iSQL*Plus would be easier to access from Java since it's web-based, though this is a complete guess since I don't know Java.

    This all sounds like rather a lot of work for something that will be very inefficient, though.

  5. #5
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    There is no need to capture a describe. Simply use the correct select and you can emulate the desc command.


    Code:
     
    select column_name NAME,
            decode( nullable, 'Y', NULL, 'NOT NULL' ) XNULL,
            data_type||'('||
            substr(
            decode( data_type, 'NUMBER',
                    decode( data_precision, NULL, NULL,
                     data_precision||','||data_scale||')' ),
                        data_length||')'),1,11) TYPE
     from all_tab_columns
     where owner = 'USER'
      and table_name = 'CUST_SSN'
     order by column_id;
    
    NAME                           XNULL      TYPE
    ------------------------------ ---------  ------------------------------
    CUST_CD                        NOT NULL   VARCHAR2(10)
    SSN                                       VARCHAR2(11)
    
    DESC CUST_SSN
     Name                            Null?    Type
     ------------------------------- -------- ----------------------
     CUST_CD                         NOT NULL VARCHAR2(10)
     SSN                                      VARCHAR2(11)
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

  6. #6
    Join Date
    May 2004
    Location
    Dominican Republic
    Posts
    721
    But then again, DESCRIBE also works for procedures/functions/etc..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •