Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2009
    Posts
    17

    Question Unanswered: how to validate SQL without executing ?

    Hi All,

    Can anyone do let me know how to validate SQL without executing ?

    e.g.
    create table users
    (
    logon varchar2(8),
    password varchar2(100)
    );

    I want to check whether thi is valid or not without execute statement.


    Regards,
    Sandeep Sutar

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    You can test the SQL using the DBMS_SQL package like this:

    Code:
    declare
       c number;
       l_sql long := 'create table users
    (
    logon varchar2(8),
    password varchar2(100)
    )';
    begin
       c := dbms_sql.open_cursor;
       dbms_sql.parse(c,l_sql,dbms_sql.native);
    end;
    /
    Note: I had to remove the semi-colon from the end of the create table statement to avoid "ORA-00911: invalid character" error.

Posting Permissions

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