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
Solved

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

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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 …
Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.

860 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