?
Solved

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

Posted on 2014-02-20
3
Medium Priority
?
370 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 143

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 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.
Suggested Courses

764 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