Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2010
    Posts
    8

    Unanswered: run time error ORA-06512,ORA-00922

    hi ,
    plz see the error it create a table test

    create table test
    (emp_id varchar2(5),
    e_mail varchar2(30),
    ename varchar2(30));

    Table created.

    insert all
    into test (emp_id, e_mail, ename) values (1, 'l@mail.com', 'Little')
    into test (emp_id, e_mail, ename) values (2, 'f@mail.com', 'Foot')
    into test (emp_id, e_mail, ename) values (3, 'b@mail.com', 'Balistic')
    into test (emp_id, e_mail, ename) values (1, 'l@mail.com', 'Little')
    into test (emp_id, e_mail, ename) values (2, 'f@mail.com', 'Foot')
    into test (emp_id, e_mail, ename) values (3, 'b@mail.com', 'Balistic')
    select * from dual;

    commit;

    now i wrote a procedure to create a table based on parameter that what i passed

    create or replace procedure this_emp(ename varchar2) is
    begin
    execute immediate 'create table '||ename||'CREATE TABLE TEST (EMP_ID VARCHAR2 (5), E_MAIL VARCHAR2 (30), ENAME VARCHAR2 (30))';
    end;

    ok it complied succesfully but while iam call porcedure it shows the error

    ORA-00922: missing or invalid option
    ORA-06512: at "this_EMP", line 8

    plz give me the help thank you,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Rule of thumb with dynamic SQL: put the statement you are about to execute into a local variable. Display its contents with DBMS_OUTPUT.PUT_LINE procedure. Review it. If it works fine when run in SQL*Plus (i.e. pure SQL), it will run fine in PL/SQL (i.e. your procedure).

    What you did is (just an example)
    Code:
    create table adams create table test (emp_id varchar2(5) ...
    A nonsense, obviously. Fix it.

Posting Permissions

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