Print Thread
How to create a view with a "WITH FUNCTION" clause ?
#61547 05/01/20 08:43 AM
Joined: Mar 2012
Posts: 38
Switzerland
Member
OP Offline
Member
Joined: Mar 2012
Posts: 38
Switzerland
It seems that we could only create such view with SQL*Plus, but not with PLSQL Developer.
SQL Query
CREATE OR REPLACE VIEW test$v AS 
    WITH
      FUNCTION with_function(p_id IN VARCHAR2) RETURN VARCHAR2 IS
      BEGIN
        RETURN p_id;
      END;
    SELECT with_function(dummy) AS dummy
    FROM   dual;
    /
This gives this error :
  • ORA-06553: PLS-103: Encountered the symbol "end-of-file"

I've tried with SQL window, command window and program window.

Note: Post on Stack Overflow

Re: How to create a view with a "WITH FUNCTION" clause ?
Philippe Malera #61549 05/01/20 09:00 AM
Joined: Aug 1999
Posts: 22,220
Member
Offline
Member
Joined: Aug 1999
Posts: 22,220
You need to omit the last semi-colon and place the trailing slash at the start of the line:

Code
CREATE OR REPLACE VIEW test$v AS 
    WITH
      FUNCTION with_function(p_id IN VARCHAR2) RETURN VARCHAR2 IS
      BEGIN
        RETURN p_id;
      END;
    SELECT with_function(dummy) AS dummy
    FROM   dual
/


Marco Kalter
Allround Automations
Re: How to create a view with a "WITH FUNCTION" clause ?
Marco Kalter #61551 05/01/20 09:33 AM
Joined: Mar 2012
Posts: 38
Switzerland
Member
OP Offline
Member
Joined: Mar 2012
Posts: 38
Switzerland
Thanks


Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.030s Queries: 14 (0.007s) Memory: 2.5075 MB (Peak: 3.0430 MB) Data Comp: Off Server Time: 2024-05-19 21:57:14 UTC
Valid HTML 5 and Valid CSS