On 2012-06-22 14:09, ktadimeti wrote: > I wish to output text from a stored procedure. How do I do this? > Is there an alternative to the DBMS_OUTPUT package in oracle, or even a > simple PRINT statement?
I'm not sure I understood you correctly, but you can just select rows from a "selectable" stored procedure. A trivial example: create procedure TXOUT returns (SINGLE_ROW varchar(200)) as SINGLE_ROW = 'the first row'; suspend; -- returns a record SINGLE_ROW = 'the second row'; suspend; -- returns a record end When issuing select * from TXOUT you get SINGLE_ROW ============================== the first row the second row Obviously, the text can come from whatever source you need (e.g. can be selected from a table inside the procedure). That's not exactly what DBMS_OUTPUT in Oracle does, but can serve as a simple debug output (in fact DBMS_OUTPUT package usually doesn't serve any other purpose either). The drawback is that it doesn't work with triggers (but you haven't mentioned triggers, have you? ;) ). Have you thought about inserting the text into a predefined table and selecting it from another piece of code? I suppose that's more or less what DBMS_OUTPUT does - PUT_LINE inserts a line of text into a "well known" table, while GET_LINE retrieves the oldest row and deletes it. I think this functionality can be easily implemented with two stored procedures and a table. regards Tomasz -- __--==============================--__ __--== Tomasz Tyrakowski ==--__ __--== SOL-SYSTEM ==--__ __--== http://www.sol-system.pl ==--__ __--==============================--__
