Displaying table data through plsql procedure -
i trying display table info through plsql code when executes procedure show procedure successful. not output.please help.
create or replace procedure carinfo v_serial car.serial%type; v_cid car.cid%type; v_make car.make%type ; v_model car.model%type; v_cyear car.cyear%type; v_color car.color%type; v_trim car.trim%type; v_enginetype car.enginetype%type; v_purchinv car.purchinv%type; v_purchdate car.purchdate%type; v_purchfrom car.purchfrom%type; v_purchcost car.purchcost%type; v_freightcost car.freightcost%type; v_totalcost car.totalcost%type; v_listprice car.listprice%type; begin select serial, cid, make, model, cyear, color, trim, enginetype, purchinv, purchdate, purchfrom , purchcost, freightcost, totalcost, listprice v_serial, v_cid, v_make, v_model, v_cyear, v_color, v_trim, v_enginetype, v_purchinv, v_purchdate, v_purchfrom , v_purchcost, v_freightcost, v_totalcost, v_listprice car cid null; exception when no_data_found dbms_output.put_line('no data found') ; dbms_output.put_line(v_serial||' ' || v_cid||' ' ||v_make||' ' ||v_model||' ' ||v_cyear||' ' ||v_color||' ' ||v_trim||' ' ||v_enginetype||' ' ||v_purchinv||' ' ||v_purchdate||' ' ||v_purchfrom ||' ' ||v_purchcost||' ' ||v_freightcost||' ' || v_totalcost||' ' ||v_listprice); end;
in brief, write procedure following way:
create or replace procedure carinfo l_result_clob clob; begin select serial ||' ' || cid ||' ' ||make ||' ' ||model ||' ' ||cyear||' ' || color ||' ' ||trim ||' ' ||enginetype||' ' ||purchinv ||' ' || purchdate||' ' ||purchfrom ||' ' ||purchcost ||' ' ||freightcost||' ' ||totalcost||' ' ||listprice l_result_clob car cid null; dbms_output.put_line(l_result_clob); exception when no_data_found dbms_output.put_line('no data found') ; when others dbms_output.put_line('sqlcode: ' || sqlcode) ; end carinfo;
that of course, if columns in select statement convertible character/clob, oracle implicitly convert them, in order concatenation happen.
cheers
Comments
Post a Comment