dcsimg
Results 1 to 2 of 2

Thread: Error Creating Function returning SQL query - New to Oracle

Hybrid View

  1. #1
    Join Date
    Jun 2013
    Posts
    1

    Error Creating Function returning SQL query - New to Oracle

    Error creating simple function returing query... can somebody give me the proper syntax for this...
    Compilation failed,line 4 (14:17:24)
    PLS-00103: Encountered the symbol "CREATE" when expecting one of the following: begin


    ---------------------------------------------------------------------------------

    create or replace function "CUSTOM_STACKCHART"
    return VARCHAR2
    is
    CREATE or REPLACE function CUSTOM_STACKCHART
    l_qry VARCHAR2(32767);
    BEGIN
    l_qry := 'select t2.id from inv_costs t2 where (t2.parent_id = :P0_FILTER_COSTS or t2.id = :P0_FILTER_COSTS) and rownum = 1 start with t2.id = t.id connect by t2.id = prior t2.parent_id) as highest_cost_id,
    t.*
    from inv_costs t where t.code1 is not null start with t.id = :P0_FILTER_COSTS connect by prior t.id = t.parent_id';

    RETURN l_qry;
    END CUSTOM_STACKCHART;

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,913
    create or replace function "CUSTOM_STACKCHART"
    return VARCHAR2
    is
    CREATE or REPLACE function CUSTOM_STACKCHART


    You don't need second CREATE statement

Tags for this Thread

Posting Permissions

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