Basic Stored Procedure Help - Not Returning Data

Hello All:
To be fair, I come from a SQL Server environment and have never written anything for PL/SQL / Oracle before, this is my first attempt, so if anything is better or more efficient, please let me know. The immediate problem I am having is, I have the Stored Procedure below, and all I want to do is return the data in the table, so that I can fill my DataSet in code. But when I run the code against this stored procedure, it always brings back no data (if I simply do a standard "SELECT * FROM lkAllocation", I get the results, so I know data is there and the connection is good). If run the procedure in my window in Oracle SQL Developer (call PAYSOL.spallocationselectall();), my results window shows no data as well. What is wrong with this Store Procedure?
create or replace
PROCEDURE spAllocationSelectAll IS
AllocationID Integer;
AllocationName Varchar2(50);
BEGIN
AllocationID := 0;
AllocationName := '';
SELECT
AllocationID,
AllocationName
INTO
AllocationID,
AllocationName
FROM
lkAllocation
ORDER BY
AllocationName;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHEN OTHERS THEN
-- Consider logging the error and then re-raise
RAISE;
END spAllocationSelectAll;

Hi and welcome to the forum.
But when I run the code against this stored procedure, it always brings back no data I presume that your code will fail when having more than one record in your table.
Did you check your error logging table?
Anyway:
Your approach will not give you your desired results.
You're selecting two column values in two variables and nothing else happens.
No OUT-parameters declared
Perhaps you're better off using a function instead of a procedure etc,etc...
When you have more than one record on your table, you'll run into a TOO_MANY_ROWS error this way...
See:
PL/SQL 101 : Understanding Ref Cursors
and
Re: Dynamic sql or ref cursor or what
or
How to return table value from stored procedure without ref cursor
In short: do a search on this forum on 'REF CURSOR'...
Also try to read, learn, do searches and understand a bit about Oracle, by studying the docs.
http://www.oracle.com/pls/db102/homepage
Concepts: http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/toc.htm
Fundamentals: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/toc.htm
And check out http://asktom.oracle.com as well...

Similar Messages

  • Why recompiling a stored procedure would change returned data?

    We have a web ASP.net application and Oracle database. Everything was working fine for at least last 5 years and now we can't figure out why
    our stored procedures no longer work.
    Here is what huppening
    On our Oracle database if we do SELECT * FROM web_usertable we see every user who can ‘access’ the our system via website.
    user1 is me
    583 user1 null John q us 0 02 605
    670 user2 null Ed      Black us 0 02 693
    Information about me and user2 is in the Oracle.
    The only difference is that I have been in the database for years and user2 is for about one month.
    When I go to the website and ‘enter’ ... Website is calling USP_GETUSERPROFILE that returns all my data. Everything works fine
    When user2 performs exactly the same task no data from Oracle is being returned. (Why NOT??? Data is in the Oracle Table)
    Order of things doesn’t make any difference: I can go 1st and everything would work ... then user2 and his data isn’t working OR he can go 1st and nothing being returned and I go 2nd and everything will work for me.
    Here is what we found and it is only one of many ways we can reproduce this problem:
    I go 1st and everything would work (We know that code and Stored Procedure is working) user2 goes 2nd and no data is returned (Something is wrong)(Why NOT??? Data is in the Oracle Table)
    Without closing any windows or restarting any application or IIS or any other actions … if at this point we simply drop and recreate USP_GETUSERPROFILE all user2 data immediately comes back.
    This issue is not only occurring with user2 data. It appears that any recently added user has this problem.
    It also isn’t limited to the USP_GETUSERPROFILE procedure we found other instances when recompiling a Stored Procedure solved a problem.
    We don't even know where to look. We also suspect that it might have someting to do with .NET because some other stored procedures in our applications being executed by C++ code don't have this problem.
    Edited by: user11296530 on Aug 21, 2009 10:56 AM

    terrn wrote:
    that would do it, I guess
    now the newbie question: within the function block: how do I assign the results va1 and va2 from a select query into the attributes of the object? I couldn't find an example where that's demonstrated (if possible).
    simplified I should have:
    create or replace function my_function(a number, b varchar2) return my_type
    as
    my_obj my_type;
    begin
    -- here:
    select val1, val2 from table1 -- this is always only one row
    -- my_obj := my_type(a,b); -- how do I assign those here?
    return my_obj;
    end
    select my_type(val1,val2) into my_obj
    from table1;Edited by: Toon Koppelaars on Feb 24, 2011 10:16 AM

  • Report with Stored Procedure does not return until refresh

    I'm using RAS server 2008 to run many Crystal reports from a web application (TrackWise) over Oracle 10g DB.
    A new report is using a stored procedure that takes several minutes (5-10) to return before the rest of the report's SQL can execute.
    When running the report from Crystal Developer there is no problem,
    but when running from the application (using the RAS), the report seems to be running forever,
    However, if you wait a few minutes for the DB utilization to drop (i.e. for the stored procedure to finish) and refresh - the full report appears on the screen in a second.
    Since I have many other reports that run for much longer time with no issue, I assume that this has nothing to do with the web application, but rather related to the connection between the RAS and the DB (i.e. the idle time between the beginning of the stored procedure execution to its return and the continuation of the report creation).
    I assume that I need to change one of the RAS settings/ parameters (in the properties or in the registry), but which?
    Please assist.

    Since this app is from TrackWise, I'd recommend contacting TrackWise and see if they have an answer for you. As it is, we have no idea how they implemented the CR components in their app. If they cannot help you, it should be them coming here and asking us - or better yet they should be creating a phone incident.
    - Ludek
    Senior Support Engineer AGS Product Support, Global Support Center Canada
    Follow us on Twitter

  • Stored Procedure used as a data source for an Apex report

    Just wondering whether anyone has used a Stored Procedure as the data source for an Apex report. An option to select Stored Procedures(s) as the data source does not appear within the IDE (only displays Table, Views, Functions).
    Do you have to return the definition of the Stored Procedure via a function ... if so, how is this done ?
    Thank you.

    >
    Welcome to the forum: please read the FAQ and forum sticky threads (if you haven't done so already), and update your profile with a real handle instead of "920338".
    When you have a problem you'll get a faster, more effective response by including as much relevant information as possible upfront. This should include:
    <li>Full APEX version
    <li>Full DB/version/edition/host OS
    <li>Web server architecture (EPG, OHS or APEX listener/host OS)
    <li>Browser(s) and version(s) used
    <li>Theme
    <li>Template(s)
    <li>Region/item type(s)
    With APEX we're also fortunate to have a great resource in apex.oracle.com where we can reproduce and share problems. Reproducing things there is the best way to troubleshoot most issues, especially those relating to layout and visual formatting. If you expect a detailed answer then it's appropriate for you to take on a significant part of the effort by getting as far as possible with an example of the problem on apex.oracle.com before asking for assistance with specific issues, which we can then see at first hand.
    Just wondering whether anyone has used a Stored Procedure as the data source for an Apex report. An option to select Stored Procedures(s) as the data source does not appear within the IDE (only displays Table, Views, Functions).
    Do you have to return the definition of the Stored Procedure via a function ... if so, how is this done ? When asking a question about "reports" it's firstly essential to differentiate between standard and interactive reports. Standard reports can be based on tables, views, SQL queries, or PL/SQL function blocks that return the text of a SQL query. Interactive reports can only be based on a SQL query.
    "Stored Procedures" are therefore not an option (unless you are using the term loosely to describe any PL/SQL program unit located in the database, thus including functions). What would a procedure used as the source of a report actually do? Hypothetically, by what mechanisms would the procedure (a) capture/select/generate data; and (b) make this data available for use in an APEX report? Why do you want to base a report on a procedure?

  • SOAP TO JDBC scenario: calling stored procedure which will return the value

    Hi
    I have Soap To Jdbc scenario in which I am going to call the Stored Procedure at target side which will be executed and it is going to return the result set .
    Result contains following values.
    return code as ( 0 Or 1) and also specific exception message if its return code as 1.
    Could you suggest me the way by which I can handled this return code and send it back to the Sap PI system then the same thing is directed the to SMTP server for sending mail to consern person.
    Regards
    Kumar

    The OUT parameters of stored procedure will be returned as response. Where exactly are you facing the proble? Here is a complete walkthourgh
    /people/luis.melgar/blog/2008/05/13/synchronous-soap-to-jdbc--end-to-end-walkthrough
    In your case, you don't want response at sender. Instead you want to mail it. For this you may use BPM to design your scenario with following steps
    Receive (to receive data from sender)
    Send Sync (to stored procedure and get response)
    Send Async (to mail receiver)
    Regards,
    Prateek

  • Stored procedure in  package return multiple columns from multiple tables

    Hi ,
    Can a single stored procedure return multiple column values from different tables.
    example:
    tabA: col2, tabB:col3,tabC:col4 etc.
    one more question:
    if a stored procedure like to return 10 columns for a particular record from a single table do i need to define a TYPE statement for each colum like
    TYPE col1 is TABLE of varchar
    TYPE col2 is TABLE of varchar
    here i want to return only one row, not many rows.
    thanks

    You can try one procedure with OUT or IN/OUT parameters that collect the values from one or more sql statements.
    CREATE OR REPLACE PROCEDURE P1
    (P_COD IN TABLE.COD%TYPE,
    P_DESC1 OUT TABLE1.DESC1%TYPE,
    P_DESC2 OUT TABLE2.DESC2%TYPE)
    IS
    BEGIN
    SELECT table1.DESC1, table2.DESC2
    INTO P_DESC1, P_DESC2
    FROM TABLE1, table2 WHERE
    table1.COD = P_COD and
    table1.cod = table2.cod ;
    END P1;
    JP

  • Procedure Does not return expected new rows unless I ALTER the procedure it self

    Procedure Does not return expected new rows !!!   unless I ALTER the procedure it self

    And what exactly do you alter, the code / where clause / or ...?
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Urgent: unable to call a plsql stored procedure with a struts data action

    Hello ALL,
    I'm trying to call a plsql stored procedure within a struts DataAction,
    The scenario is:
    When a user a click on a button, then it should call a specific stored procedure,,
    I create struts data action a class to handle the event which is to call the procedure
    Here is my code:
    public class RequestAction extends DataForwardAction
    public void onCall(DataActionContext ctx)
    String amDef = "model.AppModule";
    String config = "AppModuleLocal";
    ApplicationModule am =
    Configuration.createRootApplicationModule(amDef, config);
    try{
    AppModuleImpl myAm = (AppModuleImpl)am;
    DBTransaction tr = (DBTransaction) myAm.getTransaction();
    CallableStatement stmt = tr.createCallableStatement
    ("begin pkg_test.test; end;", DBTransaction.DEFAULT);
    stmt.execute();
    stmt.close();
    tr.commit();
    catch(Exception e){System.out.println(e.getMessage());}
    Configuration.releaseRootApplicationModule(am,true);
    but when I ran the application and click on the button, I got the following Exception:
    04/07/08 00:45:50 ORA-06550: line 1, column 7:
    PLS-00201: identifier 'PKG_TEST.TEST' must be declared
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    It seems that the DBTransaction object unable to see the stored procedure,
    Am I do something wrong or miss something???
    I've checked the examples on the OTN HOW TO, and searched in the JDeveloper Forum but unable to find an answer,
    Please anyone can help???
    Thanks a lot
    With Regards,
    Hayat

    Here's an example application that illustrates how to do this. I haven't had a chance to writeup a little paper to go with it yet, but will as soon as I have a chance.
    http://otn.oracle.com/products/jdev/tips/muench/storedproc/CallStoredProc.zip
    See the "callStoredProcedure" method in the application module in the Model project.
    See the "callStoredProcedure" method binding in the binding container of the "CallStoredProcedure" data page.
    Notice the name "event_callStoredProcedure" of the (Call Stored Procedure) button on the CallStoredProcedure.jsp page which triggers the declaratively invocation of the method.
    You could also call the method from code in a custom data action.
    The code example illustrates how to create your own JDBC prepared statement for invoking the stored procedure, and doing it in a way that is efficient by keeping the prepared statement around across invocations.

  • 0EC_PCA_3 does not return data in RSA3 if the target system is entered

    Hello all,
    Datasource 0EC_PCA_3 is not transferring data to the BW 7.0 system. In the ECC 6.0 system datasource 0EC_PCA_3 does not return data in RSA3 if the target system (BWDCLNT100) is entered in the selection fields. When omitting the target system all expected data is returned.
    Datasource 0EC_PCA_1 works fine for the same target system.
    There is one thread dealing with the same problem but the person does not provide the solution he found.
    Does anyone know what the issue is?
    Regards and thanks,
    József.

    The problem was solved by removing the datasource in both BW and R/3 and activating everything from scratch again. We didn't find out what was the cause of the problem, but at least it is working now.

  • Stored Procedure fails to return all rows of data.

    Our HR database uses a procedure to build a list of employee IDs (ie. 1,3,14,...1210,1215) then calls a procedure to with a variable to extract details per employee. Unfortunately the list is 947 ids, however only 887 rows are returned.
    As a test I split the list in two and called the procedure. If I add the data rows together I get 947, hence I know the employees are valid. Can anyone suggest why a long list of Ids should fail? Is there a limit a stored procedure can return?
    The procedure (simplified down a bit) is:
    ALTER PROCEDURE [dbo].[sp_Employee_CreateTable]
     @EmpIds varchar(4000)
    AS
    SELECT    E.empid as EmpId ,E.Surname
        FROM    Employee E
        WHERE  (E.[EmpID] IN (select * from GetAllUsersUnderManager(@EmpIds))) AND EJ.id=dbo.GetCurrentEmployeeJobRecord(EJ.empid)--EJ.dateto IS NULL
    I can run the procedure as:
    "exec sp_Employee_CreateTable @EmpIds=N'1,3,14.....999'" which returns (say) 700 rows  and  "exec sp_Employee_CreateTable @EmpIds=N'1001,.....1215'" which returns 247 rows. (ie. 700+247 = 947 which is correct.
    But exec sp_Employee_CreateTable @EmpIds=N'1,3,14......1215' only returns 887 rows.
    I have looked at the length of the data passed to the procedure (1,3,...1215) which equals 4126 chars, therefore I bumped the varchar space from 4,000 to 6,000 which is still within limits, however the number of rows returned was still 887.
    Any help would be gratefully received.

    Hi Scott. I run the script you suggested (thank you), the var EmpIds was set to a string with over 930 ids. The returned data set started with 0 but only had 888 rows. As mentioned above I refer the 930+ list as full list, and the 888 as the short list.
    The difference (around 47) were the last values in the full list.
    Although EmpIds was set to 6K it definately seems like it gets to around 4K chars then ignores any other values.
    Re "since you pass....". Absolutely. I have modified the Employee_CreateTable with the var update to 6K/
    ALTER PROCEDURE [dbo].[sp_Employee_CreateTable]
     @EmpIds varchar(6000),
     @IncludeLeavers Bit
    AS
        SELECT    E.empid as EmpId ,E.Surname, E.Firstname as Forename,E.PayrollID, E.intextno as Extension, EJ.position as Position, [dbo].[GetEmployeeDepartment](E.empid) as Department, [dbo].[GetEmployeeLocation](E.empid) as Location,
    E.title as Title, EJ.ReportsTo,
                CoEmail,E.[left]
        FROM    Employee E INNER JOIN EmployeeJobs EJ
        ON        E.empid = EJ.empid
        WHERE  (E.[EmpID] IN (select * from GetAllUsersUnderManager(@EmpIds))) AND EJ.id=dbo.GetCurrentEmployeeJobRecord(EJ.empid)--EJ.dateto IS NULL
                AND (E.[left]=0 or E.[left]=@IncludeLeavers)
        ORDER BY E.Surname, E.Firstname, E.empid

  • Stored Procedure Help: Source does not have a runnable target

    I'm an MS-SQL guy, so I'm fairly familiar with T-SQL syntax, but am having one heck of a time trying to take code I've written for SQL and transform it to work with Oracle.
    Anyways, I'm using Oracle's SQL Developer, and I've got a stored procedure that calls the Alter Table statement and adds a column to it. I'm just trying to get this one to work before I move on to the other one's I have. I keep getting the message Source does not have a runnable target when I try running this command.
    create or replace PROCEDURE rta_conv_addcolumn(rtatablename1 in varchar(20),
    rtatablename2 in varchar(20),
    rtacolumnname in varchar(256),
    rtacolumninfo in varchar(256))
    AS
    DECLARE rtasql VARCHAR(4000);
    BEGIN
    IF EXISTS (SELECT * FROM user_tables WHERE table_name = rtatablename1)
    AND NOT EXISTS (SELECT * FROM user_tab_columns WHERE column_name = rtacolumnname
    AND table_name = rtatablename1)
    AND NOT EXISTS (SELECT * FROM user_tab_columns WHERE column_name = rtacolumnname
    AND table_name = rtatablename2)
    Then rtasql:= 'ALTER TABLE ['+rtatablename2+'] ADD ' + rtacolumnname + ' ' + rtacolumninfo;
    Execute (rtasql);
    END rta_conv_addcolumn;
    If I try compiling it I get the following messages, which don't make sense, since the syntax I'm using for declaring the input variables looks to be right.
    Error(1,54): PLS-00103: Encountered the symbol "(" when expecting one of the following: := . ) , @ % default character The symbol ":=" was substituted for "(" to continue.
    Error(2,29): PLS-00103: Encountered the symbol "(" when expecting one of the following: := . ) , @ % default character The symbol ":=" was substituted for "(" to continue.
    Error(3,29): PLS-00103: Encountered the symbol "(" when expecting one of the following: := . ) , @ % default character The symbol ":=" was substituted for "(" to continue.
    Error(4,29): PLS-00103: Encountered the symbol "(" when expecting one of the following: := . ) , @ % default character The symbol ":=" was substituted for "(" to continue.
    Error(6,1): PLS-00103: Encountered the symbol "DECLARE" when expecting one of the following: begin function package pragma procedure subtype type use <an identifier> <a double-quoted delimited-identifier> form current cursor external language The symbol "begin" was substituted for "DECLARE" to continue.
    Error(15,5): PLS-00103: Encountered the symbol "RTA_CONV_ADDCOLUMN" when expecting one of the following: if

    What table you want to add the column to? rtatablename1 or rtatablename2? I assumed 1 for now.
    I tried to preserve your code structure so you can familiarize with it.
    This piece should work, but you need to make sure you validate the parameters you concatenate to your strings when you use dynamic SQL.
    That's when SQL injection takes place: when you trust the parameters you are receiving and don't validate them.
    Also remember that DDL statements execute an implicit commit. Any previous DML operations you have pending will be commited by
    this EXECUTE IMMEDIATE call if it succeeds.
    I'd recommend some reading at the Oracle docs regarding those topics and the invoker's vs definer's rights for procedures.
    It basically means that as a default behaviour, the user running the procedure "borrows" the rights and privileges of the procedure owner,
    and that guy is usually super-privileged.
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10472/subprograms.htm#LNPLS00809
    CREATE OR REPLACE PROCEDURE rta_conv_addcolumn
      rtatablename1 IN VARCHAR,
      rtatablename2 IN VARCHAR,
      rtacolumnname IN VARCHAR,
      rtacolumninfo IN VARCHAR
    ) AS
      rtasql VARCHAR(4000);
      v_count NUMBER;
    BEGIN
      SELECT COUNT(*)
        INTO v_count
        FROM user_tables
       WHERE table_name = upper(rtatablename1)
             AND NOT EXISTS (SELECT *
                               FROM user_tab_columns
                              WHERE column_name = upper(rtacolumnname)
                                    AND table_name = upper(rtatablename1))
             AND NOT EXISTS (SELECT *
                               FROM user_tab_columns
                              WHERE column_name = upper(rtacolumnname)
                                    AND table_name = upper(rtatablename2));
      IF v_count > 0
      THEN
        -- is it to the rtablename1 or 2 you want to add this column to?
        rtasql := 'ALTER TABLE ' || rtatablename1 ||' ADD ' || rtacolumnname || ' ' || rtacolumninfo;
        EXECUTE IMMEDIATE rtasql;
      END IF;
    END rta_conv_addcolumn;Edited by: fsitja on Dec 11, 2009 11:21 PM

  • How to Store the result sets of a stored procedure that is returning more that one result set in two different table ?

    Hi Experts,
       I have on stored procedure which returns mote than one resultset i want that to store in two different temp table how can achieve this in SQL server.
     following is the stored procedure and table that i need to create.
    create procedure GetData as begin select * from Empselect * from Deptend 
    create table #tmp1 (Ddeptid int, deptname varchar(500),Location varchar(100))
    Insert into #tmp1 (Ddeptid , deptname ,Location )
    exec GetData
    create table #tmp (empid int , ename varchar(500),DeptId int , salary int)
    Insert into #tmp (empId,ename,deptId,salary)
    exec GetData
    Niraj Sevalkar

    You cant get two resultsets out of SP like this. The workaround is to merge and bring the resultsets.
    For this number of columns as well as corresponding datatypes have to be compatible. Also you will need one additional column which indicates resultset value. Then use this as filter to get your desired resultset out
    create procedure GetData as
    begin
    select 'resultset1' as Cat,*,.. N columns from Emp
    union all
    select 'resultset2' as Cat,*,.. N columns from Dept
    end
    create table #tmp1 (Ddeptid int, deptname varchar(500),Location varchar(100))
    Insert into #tmp1 (Ddeptid , deptname ,Location )
    Select column1,column2,column3
    from OPENROWSET('SQLOLEDB','Data Source=Server_name;Trusted_Connection=yes;
    Integrated Security=SSPI','Execute yourdb..GetData')
    WHERE Cat = 'resultset1'
    create table #tmp (empid int , ename varchar(500),DeptId int , salary int)
    Insert into #tmp (empId,ename,deptId,salary)
    Select column1,column2,column3, column4
    from OPENROWSET('SQLOLEDB','Data Source=Server_name;Trusted_Connection=yes;
    Integrated Security=SSPI','Execute yourdb..GetData')
    WHERE Cat = 'resultset2'
    also see
    http://sqlblogcasts.com/blogs/madhivanan/archive/2007/11/26/select-columns-from-exec-procedure-name-is-this-possible.aspx
    Another method is to populate table with relevant resultset within procedure itself and then select from the table directly outside.
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • JDBC SQL Server Channel Calling Stored Procedure Won't Return Result Set

    Good afternoon, Experts
    We're calling a stored procedure in a sender communcation channel.  I can perform any SQL SELECT statement here, but for some reason when I execute the SP (EXECUTE StoredProcedureName) The Adapter Engine returns the following:
    Database-level error reported by JDBC driver while executing statement 'DECLARE @UpdateRecords bit SET @UpdateRecords = 0 EXECUTE ExportToSAP @UpdateRecords'. The JDBC driver returned the following error message: 'com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set.'. For details, contact your database server vendor.
    Even stranger yet is is that this works just fine on our PI-DEV system.  I created an identical communication channel connecting to the same database with the same UID and PWD and it won't work in PI-QAS.
    Any help/ideas you could share would be greatly appreciated!!!
    Thanks,
    Chad

    Hi Chad.
    Normally, itu2019s a problem with your procedure. The Store Procedure is wrong and something is different between your DEV environment and QAS environment.
    Try to ask to DB team check it.
    Regards,
    Bruno

  • How to use stored procedure with many return results and variable with perl

    Hi everybody,
    i´m writtting now a Perl programm, wich use a oracle stored procedure with more than 1 result and 1 variable(I have to return 2 variable fpr each result). I don´t now how I can get it.I already search the web but I didn´t find.
    My example:
    PROCEDURE get_projects_and_sub_projects (
    v_project_id IN INTEGER,
    v_project_c_id OUT INTEGER,
    v_project_id_find OUT VARCHAR2
    IS
    BEGIN
    SELECT c_id, proj_id
    INTO
    v_project_c_id,
    v_project_id_find
    FROM t_projet
    WHERE t_projet .ksa_pro_art_kbz = 'KU'
    AND t_projet.proj_id LIKE v_project_id || '%';
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    v_project_c_id := NULL;
    v_project_id_find := NULL;
    WHEN OTHERS
    THEN
    kmessages.error (NULL,
    'get_projects_and_sub_projects',
    'Project-Name: ' || v_project_id,
    'Errornumber: '
    || SQLCODE
    || ' Error: '
    || SQLERRM,
    TRUE,
    TRUE
    raise_application_error (-20001,
    'Error '
    || SQLCODE
    || ' get_projects_and_sub_projects: '
    || SQLERRM,
    TRUE
    END get_projects_and_sub_projects;
    in Perl Program:
    sub get_projects_unterprojects_name($$){
    my ($db_handle, $proj_name_id) = @_; #$db_handle ist the DB Connection return value
    my $db_proj_c_id;
    my $db_proj_name;
    eval{ my $csr = $db_handle->prepare(q{
    BEGIN
    pro_doc_ber.get_projects_and_sub_projects(:proj_name_id, :db_proj_c_id, :db_proj_name);
    END;
    # parameter value
    $csr->bind_param(":proj_name_id", $proj_name_id);
    # return values
    $csr->bind_param_inout(":db_proj_c_id", \$db_proj_c_id, 11);
    $csr->bind_param_inout(":db_proj_name", \$db_proj_name, 20);
    $csr->execute(); };
    But this didn´t work. Could somebody give me some idea?
    Thank you
    Felx

    Some additional info would probably be helpful.
    What is your programming enviironment? Java?
    In any case I suspect that you will need to use the OCI to deal with specific Oracle types such as user defined object types -- thats not standard ANSI SQL.
    In Java I believe you need to use OPAQUE, there are some examples out there. I'm mostly a PL/SQL developer with some Java expereince so others here are more qualifed to answer your question more directly.

  • PHP Calling Stored Procedure Help!

    I have been messing with this code for weeks now and read a ton of forums and archives and I can't figure this out for the life of me.... I included the Stored Procedure and the PHP code and the ERROR I am getting below. Someone else in my company wrote the stored procedure. I am running PHP Version 4.3.9
    THANK YOU SO MUCH TO ANYONE IN ADVANCE!
    Oracle Stored Procedure
    Procedure GetDBCodes(appl_type In Varchar2,
    output_array Out str_varray,
    rtn_cd Out Number,
    rtn_errm Out Varchar2,
    rtn_spinfo Out Varchar2) As
    -- Program ID: GetDBCodes
    -- Author: Chris Calder
    -- Date Written: October 5, 2004
    -- System: Engage Thoughtware
    -- Purpose: Get the database codes for the application identified by appl_type
    -- Arguments: IN: appl_type 'ETW' = ThoughtTree
    -- 'ADM' = System Administration
    -- OUT output_array array of fixed length delimited output:
    -- company_name: 1 - 38
    -- user_name: 39 - 48
    -- db_code: 49 - 58
    -- db_version 59 - 66
    -- OUT rtn_cd: SQL return code
    -- OUT rtn_errm: Oracle error message text
    -- OUT rtn_spinfo: debugging info consisting of:
    -- procedure name and input parameter list,
    -- followed by the label of the SQL
    -- statement that caused the exception
    sql_stmt Varchar2(100);
    db_schema_name Varchar2(10);
    company_name Varchar2(40);
    db_version Varchar2(10);
    counter Number Default 0;
    lv_appl_type Varchar2(10);
    stmt_label Varchar2(40);
    data_error Exception;
    Begin
    stmt_label := '<<get_dbcodes>>';
    output_array := str_varray();
    lv_appl_type := appl_type || '%';
    For code_rec In (Select schema_name,
    db_code,
    dblink
    From etw$map.DBCode
    Where (dblink <> 'UTDEV' Or dblink Is Null)
    And schema_name Like lv_appl_type
    Order By substr(schema_name,
    4,
    3))
    Loop
    db_schema_name := 'ETWDB' || substr(code_rec.schema_name,
    4,
    3);
    If code_rec.dblink Is Null Then
    sql_stmt := 'select db_node_name, db_version from ' ||
    db_schema_name || '.masterprofile';
    Else
    sql_stmt := 'select db_node_name, db_version from ' ||
    db_schema_name || '.masterprofile' || '@' ||
    code_rec.dblink;
    End If;
    Execute Immediate sql_stmt
    Into company_name, db_version;
    -- add arrary extend and assignment here
    output_array.Extend;
    counter := counter + 1;
    output_array(counter) := rpad(company_name,
    38,
    ' ') || rpad(code_rec.schema_name,
    10,
    ' ') ||
    rpad(code_rec.db_code,
    10,
    ' ') || db_version;
    End Loop;
    Commit;
    rtn_errm := 'NONE';
    rtn_cd := Sqlcode;
    rtn_spinfo := 'CodeMap.GetDBCodes' || ' successful';
    Exception
    When data_error Then
    Rollback;
    rtn_errm := 'Appl_type value: ' || appl_type || ' is not valid';
    rtn_cd := -999;
    rtn_spinfo := 'CodeMap.GetDBCodes' || ' unsuccessful';
    When Others Then
    --** select from value table failed
    Rollback;
    rtn_errm := Sqlerrm;
    rtn_cd := Sqlcode;
    rtn_spinfo := 'CodeMap.GetDBCodes ' || stmt_label;
    End GetDBCodes;
    PHP Calling the Oracle Stored Procedure
    <?php header("cache-control: no-store, no-cache, must-revalidate"); header("Pragma: no-cache");
    $con = OCILogon('etw$map', 'pam$wte', 'LINUX_CONSONUS');
    $query = "BEGIN codemap.GETDBCODES('ETW',:results,:cd,:errm,:spinfo); END;";
    $stmt = OCIParse($con, $query) or die ('Can not parse query');
    OCIBindByName($stmt,":results", $output_array,-1);
    OCIBindByName($stmt,":cd", $rtn_cd,-1);
    OCIBindByName($stmt,":errm", $rtn_errm,-1);
    OCIBindByName($stmt,":spinfo", $rtn_spinfo,-1);
    OCIExecute($stmt);
    ?>
    ERROR I AM GETTING
    Warning: ociexecute(): OCIStmtExecute: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'GETDBCODES' ORA-06550: line 1, column 7: PL/SQL: Statement ignored in c:\inetpub\wwwroot\Projects\PopUpRef\v2\php\testOracle.php on line 17

    Ok so I got the problem fixed,
    one of the output variables coming from the stored procedure was a custom defined object. So I had to use an ocinewcollection and set the typ to the custom type oracle was using and then bind it. So now everything is working great... I just thought I would post this for any one else that runs into this...
    here is my working code:
    <?php header("cache-control: no-store, no-cache, must-revalidate"); header("Pragma: no-cache");
    $con = OCILogon('user', 'pass', 'LINUX_CONSONUS');
    $query = "BEGIN codemap.GETDBCODES('ETW',:output_array,:cd,:errm,:spinfo); END;";
    $stmt = OCIParse($con, $query) or die ('Can not parse query');
    $output_array = ocinewcollection($con,"STR_VARRAY");
    OCIBindByName($stmt,":output_array", $output_array,5000,OCI_B_SQLT_NTY);
    OCIBindByName($stmt,":cd", $rtn_cd,6);
    OCIBindByName($stmt,":errm", $rtn_errm,200);
    OCIBindByName($stmt,":spinfo", $rtn_spinfo,200);
    OCIExecute($stmt);
    ?>
    So everything is working great. but I do have another question now how do I get data out of the ocinewcollection object?

Maybe you are looking for

  • Need to Change the Standard.joboptions on Acrobat 8.0

    We are a Citrix/Terminal Server shop and have clients using Acrobat 8.0 on the server under their citrix session and they need to have the default resolution of the created PDF to change for everyone on the server from 600 dpi to 300 dpi. When I try

  • RDX drive -- terrible transfer rate (writing to drive). Is there any way to speed it up?

    I've tried both drag and drop and the Robocopy command to copy files to a RDX drive (under Win 7 home and pro). It starts off fast anough (25MB/sec) but shortly slows down to something like 1.5 MB/sec.  Just 35GB takes well more than 2 hours to copy.

  • What are the Server and Domain settings to sync ou...

    I've managed to get Outlook 2010 set up as an exchange server - couldn't carry on trying to use it with hotmail connector - it just didn't work. So, now on my Lumia 610 I have an Outlook account and I sign into it with my gmail email address and pass

  • Error in BAPI_SALESORDER_CHANGE -- Enter The Profit Center

    Hi All, Am Creating Sales Order using BDC and getting Sales order number and uploading it's  Item text using BAPI_SALESORDER_CHANGE , But am getting error as please enter profit center for last record in Bapireturn and text is not getting updated. Ev

  • Wireless printing from ibook

    help Please! I have an HP7310 connected to my imac g5. I have an ibookg4. Im connected to dsl using 2-wire modem/router. I am trying to print from my ibook. I was told that if I set my imacg5 to share printer, I could do so. However, every-time that