Home » SQL & PL/SQL » SQL & PL/SQL » display from a procedure
display from a procedure [message #7952] Fri, 18 July 2003 08:18 Go to next message
Joe
Messages: 138
Registered: November 1999
Senior Member
forgive my newbie-ness...I would like to display the results of a query in an html format, or even simply as standard output...is this possible to do in a procedure? I have created a procedure, but obviously it doesn't format the output...actually the proc fails, but the query works so hopefully someone out here can help..

create or replace procedure netzero_proc
is
begin
select blah from table_a
where blah=blah
and timestamp > (sysdate-1800/86400);
end;
/
Re: display from a procedure [message #7956 is a reply to message #7952] Fri, 18 July 2003 10:18 Go to previous message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
-- this will just display the output.
-- to display in html format , add the html tags.
-- optionally, u can use a utl_file to create a HTML file and write the contents to it .
-- There are some packages available in oracle to do the html , http headers and stuff
mag@itloaner1_local > set serveroutput on
mag@itloaner1_local > ed
Wrote file afiedt.buf

  1  create or replace procedure test
  2  as
  3  cursor c1 is select * from dept;
  4  begin
  5  for mag in c1 loop
  6     exit when c1%notfound;
  7     dbms_output.put_line(mag.dname||','||mag.deptno||','||mag.loc);
  8  end loop;
  9* end;
mag@itloaner1_local > /

Procedure created.

mag@itloaner1_local > exec test
ACCOUNTING,10,NEW YORK
RESEARCH,20,DALLAS
SALES,30,CHICAGO
OPERATIONS,40,BOSTON

PL/SQL procedure successfully completed.

Previous Topic: Query..
Next Topic: Can I use One Column's Result in another column in a Query ?
Goto Forum:
  


Current Time: Wed Apr 24 06:20:41 CDT 2024