Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > Oracle
| Search | Today's Posts | Mark Forums Read
Oracle General Oracle database discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Oracle section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 8th, 2006, 08:21 AM
Friend of Wrox
 
Join Date: Jun 2004
Location: Hyderabad, , India.
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to display the result in sqlpus editor

Hi,
I have written a stored procedure in Oracle but dont know how to run the stored procedure.I want to see whether I am getting correct records or not. My stored procedure is:

CREATE OR REPLACE PROCEDURE test(tcode in varchar)
AS
    typeCode varchar(2);
    status varchar(1);
BEGIN
   SELECT TYPE_CODE,ASSET_STATUS INTO typeCode,status FROM cas_assets WHERE TYPE_CODE = tcode;
END;


Please reply me how to see the result from the stored procedure.

Thanks and regards
Lily

 
Old August 10th, 2006, 05:43 AM
Authorized User
 
Join Date: Sep 2003
Location: Delhi, Delhi, India.
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to prabodh_mishra
Default

CREATE OR REPLACE PROCEDURE test(tcode in varchar)
AS
    typeCode varchar(2);
    status varchar(1);
BEGIN
   SELECT TYPE_CODE,ASSET_STATUS INTO typeCode,status FROM cas_assets WHERE TYPE_CODE = tcode;

/*
For debugging purposes only
Run "Set ServerOutput On" statement, to get the result on to the iSql window, before calling the procedure.
*/

DBMS_OUTPUT.PUT_LINE (typeCode);
DBMS_OUTPUT.PUT_LINE (status);

END;


 
Old November 14th, 2006, 02:44 AM
Registered User
 
Join Date: Nov 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

run procedure as follows

exec test('your argument');

 
Old November 22nd, 2006, 03:26 PM
Registered User
 
Join Date: Nov 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Forgive me if I state the obvious, but before executing your stored procedure you'll first have to "store" it. Let's say you've got the TEST code in your PC's C:\TEMP directory, as TEST.SQL Via SQL*Plus: @C:\TEMP\TEST.SQL Then, again via SQL*Plus: / You'll get a PROCEDURE CREATED response. Then you'll be able to execute the procedure just as vijaykpit has mentioned.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Decode function to display result in same row yogeshyl SQL Language 0 July 2nd, 2008 12:40 AM
Display Search Engine result in table using JSP sbc789 JSP Basics 3 December 3rd, 2007 11:35 PM
GridView and SQL More than one result = one result DarkForce ASP.NET 2.0 Basics 0 July 20th, 2007 04:29 AM
how to display the result elania PHP Databases 3 February 21st, 2005 03:07 PM
display the result of query in textbox. Abhinav_jain_mca ADO.NET 4 August 3rd, 2004 03:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.