Creating a Procedure in Oracle to create View in dynamic way please [duplicate]

I'm making procedure to make view in dynamic way, but I got problem and this is my code

On Compilation, I'm get error which says

ORA-00911: invalid character
ORA-06512: at "APPS.BIKINSCRIPT", line 80
ORA-06512: at line 3

please help me and thank you


And we're, kind of, supposed to imagine code you wrote and debug it that way? Why didn't you post it?

Anyway: if you do it right, it works:

SQL> create or replace procedure p_view as
  2  begin
  3    execute immediate 'create or replace view v_dept ' ||
  4                      '  as select * from dept';
  5  end;
  6  /

Procedure created.

SQL> exec p_view

PL/SQL procedure successfully completed.

SQL> select * from v_dept;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON

SQL>

If I must, I'd put my bet on a terminating semi-colon:

SQL> create or replace procedure p_view as
  2  begin
  3    execute immediate 'create or replace view v_dept ' ||
  4                      '  as select * from dept;';
  5    --                                        ^
  6    --                                     this semi-colon
  7  end;
  8  /

Procedure created.

SQL> exec p_view
BEGIN p_view; END;

*
ERROR at line 1:
ORA-00911: invalid character
ORA-06512: at "SCOTT.P_VIEW", line 3
ORA-06512: at line 1


SQL>

If that's so, remove it.


Yet another objection: we normally don't create view dynamically; there's rarely a good reason to do so. Dynamic SQL exists, but it doesn't mean that you have to use it. You'd rather create objects at SQL level.