Solved

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

Posted on 2014-02-20
3
366 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 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.

705 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