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;