sql - Sorting an Oracle table inside a stored procedure -
i have stored procedure running .sql file takes in inputs users , runs procedure. procedure runs many queries , inserts row of values table. in .sql file have order table column after finish running queries. have:
declare nameparam varchar2(200); versionparam varchar2(200); startdate date; enddate date; begin nameparam := '&1'; versionparam := '&2'; startdate := '&3'; enddate := '&4'; procedure(nameparam, versionparam, startdate, enddate); commit; select * table_name order column_name asc; exception when others raise_application_error(-20101,sqlerrm); end; /
however throws error:
pls-00428: clause expected in select statement
i dont know why needs clause. help?
edit: clarify don't want see output of sorted table table updated , sorted column in ascending order.
if put select
statement in pl/sql block, need results. if you're expecting 1 row, you'd select into
local variable. assuming expecting multiple rows, write for
loop iterates on rows or bulk collect
rows pl/sql collection. open sys_refcursor
since there no way return anonymous pl/sql block, seems unlikely want.
my guess want select
statement outside pl/sql block , want whatever tool using execute .sql script run pl/sql block populate table , run select
statement, writing results whatever file/ console spooling output to.
Comments
Post a Comment