Create view with inline function in db<>fiddle



  • I'm trying to create a view with in inline function in db<>fiddle.

    I've removed the CREATE VIEW part for now, and am just trying to run the query, just to get to the root issue.

    select  /*+ WITH_PLSQL */ calc from
    (
    with
    function calculator (m number, r number) return number
    is begin
    return m * r;
    end calculator;
    select calculator(3, 2) as calc from dual
    );
    /
    

    Source: https://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:9534452300346807610#:%7E:text=30%20am%20UTC-,This%20appears%20to%20be%20a%20client%20issue,-%2C%20which%20environment%20are

    When I run that code in https://dbfiddle.uk/?rdbms=oracle_11.2&fiddle=1a73f5bfb341d2b29468423be18a9b49 , I get an error:

    ORA-00905: missing keyword
    

    What am I doing wrong?



  • What went wrong

    1. That feature didn't exist in 11.2
    2. You used the question SQL, not the answer SQL

    Correction

    My answer is the same. Define it in the outer most WITH statement.

    with
    function calculator (m number, r number) return number
    is begin
    return m * r;
    end calculator;
    select calculator(3, 2) as calc from dual
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2