Solved

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

Posted on 2014-02-20
3
357 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]
ID: 39876646
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
ID: 39877164
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
ID: 39877425
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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Via a live example, show how to take different types of Oracle backups using RMAN.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

832 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