Solved

How to implement and exec Oracle procedure with IN and OUT parameter(s)

Posted on 2014-02-20
3
354 Views
Last Modified: 2014-04-14
I have an Oracle procedure:

create or replace
PROCEDURE GetProfileDetails
(
  v_ProfileID IN NUMBER DEFAULT NULL ,
  v_Name OUT VARCHAR2,
  v_Description OUT VARCHAR2,
  v_ProfileData OUT VARCHAR2
)
AS

BEGIN

   SELECT NAME ,
          DESCRIPTION ,
          ProfileData

     INTO v_Name,
          v_Description,
          v_ProfileData
     FROM Profiles
     WHERE ProfileID = v_ProfileID;
     
END;

Questions
(1) Is this procedure correct? It appears to have compilation problem, but don;t know what problem.
(2) How to call this procedure?
declare
  v_Name  VARCHAR2(200),
  v_Description  VARCHAR2(200),
  v_ProfileData  VARCHAR2(5000)

execute GetProfileDetails (2,  v_Name out, v_Description out,  v_ProfileData out)
Is this ocrrect?
0
Comment
Question by:chuang4630
  • 2
3 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
Comment Utility
the procedure code is syntax-wise correct. what error do you get? how do you "run" that code to create the procedure

when you refer to "how to call", you refer to by C#?
which connectivity library do you want to use? (Oracle, OleDB, ODBC?)
what exactly is the issue?
0
 
LVL 1

Author Comment

by:chuang4630
Comment Utility
I am talking about the exec the proc in Oracle SQL Developer. Not from C#
Just like what we do in SQL Management Studio for MS SQL
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
Comment Utility
ok, I will move the question accordingly.

the code would be like this:
declare
  v_Name  VARCHAR2(200);
  v_Description  VARCHAR2(200);
  v_ProfileData  VARCHAR2(4000);
begin
   GetProfileDetails(2,  v_Name out, v_Description out,  v_ProfileData out);
end; 

Open in new window

0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that useā€¦
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Via a live example, show how to take different types of Oracle backups using RMAN.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now