DBMS_OUTPUT.PUT_LINE multi records from PL/SQL procedure to Java web page.

Hello
I will explain the scenario:
In our java web page, we are using three text boxes to enter "Part number,Description and Aircraft type". Every time the user no need to enter all these data. The person can enter any combination of data or only one text box. Actually the output data corresponding to this input entries is from five Oracle table. If we are using a single query to take data from all the five tables, the database will hang. So I written a procedure "SEARCH1",this will accept any combination of values (for empty values we need to pass NULL to this procedure) and output data from all the five tables. When I executing this procedure in SQL editor, the execution is very fast and giving exact result. I used "dbms_output.put_line" clause for outputing multiple records in my procedure. The output variables are "Serial No, part Number, Description, Aircraft type,Part No1,Part No2,Part No3,Part No4". I want to use the same procedure "SEARCH1" for outputing data in java web page.The passing argument I can take from the text box provided in java web page. I am using jdbc thin driver to connect our java web page to Oracle 9i database.
Note1 : If any combination of search item not available, in procedure itself I am outputing a message like "Part Number not found". Here I am using four words ("Part" is the first word,"Number" is the second,"Not" s the third, and "found" is the fourth) for outputing this message.Is it necessary to equalise number of words I am using here to the record outputing eight variable?
Our current development work is stopped because of this issue. So any one familier in this field,plese help me to solve our issue by giving the sample code for the same scenario.
My Email-id is : [email protected]
I will expect yor early mail.
With thanks
Pramod kumar.

Hello Avi,
I am trying to solve this issue by using objects. But the following part of code also throwing some warning like "PLS-00302: component must be declared". Plese cross check my code and help me to solve this issue.
drop type rectab;
create or replace type rectype as object(PartNo varchar2(30),Description varchar2(150),AIrcraft_type varchar2(15),status_IPC varchar2(30),status_ELOG varchar2(30),status_SUPCAT varchar2(30),status_AIRODWH varchar2(30));
create or replace type rectab as table of rectype;
create or replace package ioStructArray as
procedure testsch2(pno in varchar2,pdes in varchar2,air in varchar2,orec in out rectab);
end ioStructArray;
create or replace package body ioStructArray as
procedure testsch2(pno in varchar2,pdes in varchar2,air in varchar2,orec in out rectab) is
mdescription varchar2(150);
mpartnum varchar2(30);
mpno varchar2(30);
mdes varchar2(150);
mair varchar2(15);
mstat varchar2(1);
cursor c1 is select partnum,description,aircraft_type from master_catalog where partnum=mpno and aircraft_type=mair and description like ltrim(rtrim(mdes))||'%';
cursor c2 is select partnum from ipc_master where partnum=mpartnum;
cursor c3 is select partnum from fedlog_data where partnum=mpartnum;
cursor c4 is select partnum from superparts where partnum=mpartnum;
cursor c5 is select part_no from supplier_catalog where part_no=mpartnum;
mpno1 varchar2(30);
mpno2 varchar2(30);
mpno3 varchar2(30);
mpno4 varchar2(30);
mpno5 varchar2(30);
maircraft_type varchar2(15);
mstat1 varchar2(30);
mstat2 varchar2(30);
mstat3 varchar2(30);
mstat4 varchar2(30);
begin
mstat:='N';
mpno:=pno;
mdes:=pdes;
mair:=air;
if mpno is not null and mdes is not null and mair is not null then
begin
mstat:='N';
mpno:=pno;
mdes:=pdes;
mair:=air;
for i in c1 loop
mstat:='N';
mstat1:='N';
mstat2:='N';
mstat3:='N';
mstat4:='N';
mpno1:=i.partnum;
mpartnum:=i.partnum;
mdescription:=i.description;
maircraft_type:=i.aircraft_type;
for j in c2 loop
mpno2:=j.partnum;
end loop;
for k in c3 loop
mpno3:=k.partnum;
end loop;
for l in c4 loop
mpno4:=l.partnum;
end loop;
for m in c5 loop
mpno5:=m.part_no;
end loop;
if mpno2=mpartnum then
mstat1:=mpno2;
end if;
if mpno3=mpartnum then
mstat2:=mpno3;
end if;
if mpno4=mpartnum then
mstat3:=mpno4;
end if;
if mpno5=mpartnum then
mstat4:=mpno5;
end if;
if mpno1=mpartnum then
mstat:='Y';
orec.PartNo:=mpno1;
orec.Description:=mdescription;
orec.AIrcraft_type:=maircraft_type;
orec.status_IPC:=mstat1;
orec.status_ELOG:=mstat2;
orec.status_SUPCAT:=mstat3;
orec.STATUS_AIRODWH:=status_AIRODWH;
end if;
end loop;
end;
end if;
end testsch2;
end ioStructArray;
Expecting your early reply.
With thanks
Pramod kumar.

Similar Messages

  • PL/SQL Procedure and Java

    Hi All,
    I am working on a Data Warehousing Product and generating Web Reports.
    These Web Reports are JSPs.
    The basic architechture used for this is :
    1. Get the inputs required for Report Generation through a Web GUI
    2. Validate and Process (If Valid) the inputs so that it can be applied on the Data in the DB to fetch appropriate information.
    3. The Data from the DB is retreived in the form of PL/SQL Procedures, which take the Processed information from Step 2 as Input and give the Output in the form of REF CURSORS.
    Note: There are a many PL/SQL Procedures that are being executed, based on the configuration the Client has set. This configuration enables the Client to set the columns he wants to see in the Web Reports. This configuration is set before the Reports are run.
    4. A call is made from Java to Oracle, each time a PL/SQL Procedure need to be executed. The REF CURSOR received as an Output from the PL/SQL Procedure is processed.
    5. The next PL/SQL Procedure is called (if existing), else the Processed Data (from REF CURSOR Output) is displayed in the JSP as Web Reports.
    The issue with above architechture is the PERFORMANCE.
    I would like to know:
    - The various ways in which data can be EFFICIENTLY & QUICKLY retrieved from PL/SQL Procedure in Java.
    - Are there any APIs that improve the Java-Oracle Data Fetch Efficiency
    - Is there any Java Framework available that can be used to increase the spped of Web Report generation.
    - Do you suggest any changes in the above mentioned architechture, that make this work a Sweet Sixeen Year olg guy! ;)
    - In general, any input that can increase the Speed of Web Report Generation.
    Kindly let me know if I have not been clear at any point, so that I can re-explain the same more clearly.
    And the most important thing, kindly scrap down your thoughts about the same.
    Thanks a lot in advance for your VALUABLE INPUTS.
    - Vikas

    Spring
    http://www.springframework.org/
    http://static.springframework.org/spring/docs/2.0.x/reference/jdbc.html
    http://static.springframework.org/spring/docs/2.0.x/reference/jdbc.html#jdbc-StoredProcedure

  • Multiple records from PL/SQL

    Hi,
    Can anybody give me an example of returning multiple records selected from PL/SQL procedure to a Java program .
    It will be very good if i can get PL/SQL procedure code and Java program code.
    Thanx.

    Use the SampleCode link at the top of the page. Look under JDBC samples for REF CURSOR.

  • Table of records from a stored procedure

    Hi
    Where could I find an example or documentation about how to retrive a table of records from a Stored Procedure ??
    Thanks

    Try:
    CREATE OR REPLACE TYPE scott.MYRECORDTYPE as object
    (a int, b varchar2(40), c date, d number(10));
    CREATE OR REPLACE TYPE scott.MYTABLETYPE is table of myrecordtype;
    CREATE OR REPLACE PACKAGE BODY scott.MYPACKAGE
    as
    type number_collection is table of number(38) index by binary_integer;
    type varchar2_collection is table of varchar2(4000) index by binary_integer;
    type date_collection is table of date index by binary_integer;
    g_data myTableType;
    empno_col number_collection;
    ename_col varchar2_collection;
    hiredate_col date_collection;
    mgr_col number_collection;
    function my_function return myTableType
    is
    begin
    select empno, ename, hiredate, mgr
    bulk collect into empno_col, ename_col, hiredate_col, mgr_col
    from emp
    order by empno; -- Get some data
    g_data := myTableType(); -- Initialize
    for i in empno_col.first .. empno_col.last loop
    g_data.extend; -- Write something in the array
    g_data(i) := myRecordtype(empno_col(i), ename_col(i), hiredate_col(i), mgr_col(i));
    end loop;
    return g_data;
    end;
    end;
    -- Demonstration-View
    CREATE OR REPLACE VIEW scott.myview
    AS
    select a,b,c,d
    from table(cast(myPackage.my_function() as mytabletype));

  • Run report from PL/sql procedure

    Please any one tell how to I run a report from pl/sql procedure.

    I am not sure, but depending on your environment you can create a script to run your PL/SQL code and then generate the report. As is customary in an UNIX environment utilizing shell scripts.

  • Creating web service from pl/sql procedure

    Hello.
    I need to create a web service from pl/sql procedure and i chose JDeveloper for this implementation. I have wsdl, but I never created web services. So, I created web service with document/literal message format.
    But I have several troubles:
    1. All element names have lower case letters.
    2. The SOAP envelope must begin from words soapenv:Envelope but i have soap:Envelope.
    3. And operation name has tail like "Element".
    I know bad way for implement 1 and 3 points. It's a modification of java_wsdl_mapping.xml and wsdl files. But if I want to add new method to my service all changes will be cleaned. It's not critical but inconvenient to support.
    But for point 3 i have no ideas.
    This task is very important for me. Can somebody help me?
    JDeveloper 10.1.3.3
    Regards,
    Aleksey

    http://www.oracle.com/technology/obe/obe1013jdev/10131/wsfromplsqlpackage/devwsfrom%20plsql.htm
    Frank

  • How to call javascript function from PL/SQL procedure

    Can anybody advice me how to call javascript function from PL/SQL procedure in APEX?

    Hi,
    I have a requirement to call Javascript function inside a After Submit Process.
    clear requirement below:
    1. User selects set of check boxes [ say user want to save 10 files and ticks 10 checkboxes]
    2. user clicks on "save files" button
    3. Inside a After submit process, in a loop, i want to call a javascript function for each of the file user want to save with the filename as a parameter.
    Hope this clarify U.
    Krishna.

  • Unix shell script run from pl/sql procedure

    Hi Guru
    I want to run unix shell script from pl/sql procedure. Actual I want to run it from developer 10g form.
    Please guide me in this regards
    Regards
    Jewel

    Look at the host or client_host builtins in the help

  • Sending message from PL/SQL procedure to form

    Hello Friends,
    How can I send messages from PL/SQL procedure to Form ?
    Ultimate target is catching progress of PL/SQL procedure from
    form. I heard about DBMS_PIPe but not sure,.
    Adi

    Hello,
    Yeah , I got the solution using DBMS_PIPE function,I
    followed following steps.
    1. Pipe is created. see below procedure.
    create or replace procedure proc_testpipe as
         v_pipe_integer          integer;
         v_pipe_message          integer;
    begin
         v_pipe_integer := DBMS_PIPE.Create_Pipe('adipipe');
         dbms_pipe.pack_message('Hello Adinath Kamode,Message
         from Pipe');
         v_pipe_message := dbms_Pipe.Send_message('adipipe');
         end;
    end;
    2. then I created one Function which will obtain message from
    Pipe and
    will return value to form.
    create or replace function proc_callpipe return varchar2 as
    v_msg          integer;
    v_rem          integer;
    v_message          varchar2(500);
    begin
    v_msg:=dbms_pipe.receive_message('adipipe');
    dbms_pipe.unpack_message(v_message);
    dbms_pipe.purge('adipipe');
    v_rem := dbms_pipe.remove_pipe('adipipe');
    return(v_message);
    end;
    3. Last I called this function from form.
    Cheers .. !
    Adi

  • Returing array from PL/SQL procedure

    Hi,
    I am trying to return array from PL/SQL procedure. Heres is the code. I am getting an error "OracleParameter.ArrayBindSize is invalid ".
    Will anybody let me know what is wrong in following code. or does anybody have code to return PL/SQL array using VB.NET.
    oCommand.CommandText = "MyPack.TestVarchar2"
    oCommand.CommandType = CommandType.StoredProcedure
    Dim id As Integer = 10
    Dim deptname As String()
    Dim oParam1 As Oracle.DataAccess.Client.OracleParameter = New Oracle.DataAccess.Client.OracleParameter("id", Oracle.DataAccess.Client.OracleDbType.Int32)
    Dim oParam2 As Oracle.DataAccess.Client.OracleParameter = New Oracle.DataAccess.Client.OracleParameter("deptname", Oracle.DataAccess.Client.OracleDbType.Varchar2)
    oParam1.Direction = ParameterDirection.Input
    oParam2.Direction = ParameterDirection.Output
    oParam1.CollectionType = Oracle.DataAccess.Client.OracleCollectionType.None
    oParam2.CollectionType = Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray
    oParam1.Value = id
    oParam2.Value = ""
    oParam1.Size = 10
    oParam2.Size = 20
    oCommand.Parameters.Add(oParam1)
    oCommand.Parameters.Add(oParam2)
    oCommand.ExecuteNonQuery()
    Thanks
    Sameer

    Thanks Arnold for the reply..
    Yes, I am trying to get result set in array which is unknow to me (No of rows return by the query). For the test I will pre-define the result set so that I will able to set ArrayBindSize.
    I have read C# example but when I try to write it in VB.NET it gives me syntax error when I try to set the ArrayBindSize.
    oParam.ArrayBindSize = new int[3]{15,23,13} // individual max size of 3 outputsWill you please let me know how to set ArrayBindSize (VB.NET) because I am new to this..
    There is an example at otn "How to: Bind an Array to an ODP.NET Database Command" which does multiple INSERTs in one trip to database. This works fine. I need to do same for the SELECT statement which will return me multiple rows. I do not mean refCursor. If I use refCursor, it will make soft parse which I am trying to avoid using this Array techniq.
    Thanks
    Sameer

  • Creating Excel Workbook from PL/SQL Procedure

    I am trying to create Excel Workbook with two worksheets from PL/SQL procedure. I created one worksheet. Can I create a separate sheet from same procedure. I used OWA_UTIL.MIME_HEADER ('application/vnd.ms-excel', FALSE)
    command to create the spreadsheet.
    Any help would be helpful.
    Thanks
    Yagna Shah

    Further to my previous post here is how I will develop a typical master details excel report.
    by using the package,
    It will also show sum of salary at each department.
    Note : When I paste the code here I loose the indentation. So the code below is not indented properly.
    DECLARE
    r NUMBER := 0 ; --- r IS the ROW NUMBER IN this excel file
    l_sum NUMBER ;
    BEGIN
    --- Generate the styles that we need
    gen_xl_xml.create_excel( 'UTL_DIR','master_Detail.xls') ;
    gen_xl_xml.create_style( 'dept_title' , 'Arial', 'Red',14, p_backcolor => 'LightGray' );
    gen_xl_xml.create_style( 'sgs2' , 'Arial', NULL ,10, p_bold => TRUE );
    gen_xl_xml.create_style( 'sgs3' , 'Arial', 'blue',14 );
    gen_xl_xml.create_style( 'sgs4' , 'Arial', 'green',14 );
    gen_xl_xml.create_style( 'emp_title' , 'Arial', 'Black',9, p_backcolor => 'LightBlue' );
    gen_xl_xml.create_style( 'sal_tot' , 'Arial', 'Brown',13, p_backcolor => 'Yellow' );
    -- SET ANY COLUMN AND ROW changes
    gen_xl_xml.set_column_width( 3, 145 );
    gen_xl_xml.set_column_width( 4, 145 );
    l_sum := 0 ;
    FOR recd IN ( SELECT department_id, department_name FROM departments ) LOOP
    IF l_sum <> 0 THEN
    r := r +1 ;
    gen_xl_xml.write_cell_char( r, 4, 'Department Total ->' , 'sal_tot' );
    gen_xl_xml.write_cell_num( r, 5, l_sum , 'sal_tot' );
    l_sum := 0;
    END if ;
    r := r+1 ;
    gen_xl_xml.write_cell_CHAR( r,1, 'Department : '|| recd.department_name , 'dept_title' );
    -- As we need same style applied till the above data flows use write_cell_null
    gen_xl_xml.write_cell_NULL( r,2 , null );
    gen_xl_xml.write_cell_NULL( r,3, 'dept_title' );
    gen_xl_xml.write_cell_NULL( r,4, 'dept_title' );
    gen_xl_xml.write_cell_NULL( r,5, 'dept_title' );
    --- Add employee heading
    r := r+1 ;
    gen_xl_xml.write_cell_CHAR( r,2, 'EmployeeID' , 'emp_title' );
    gen_xl_xml.write_cell_CHAR( r,3, 'First Name' , 'emp_title' );
    gen_xl_xml.write_cell_CHAR( r,4, 'Last Name' , 'emp_title' );
    gen_xl_xml.write_cell_CHAR( r,5, 'Salary' , 'emp_title' );
    FOR rec IN (SELECT employee_id , first_name , last_name, salary FROM employees WHERE department_id = recd.department_id ) LOOP
    r := r+1 ;
    gen_xl_xml.write_cell_num( r,2, rec.employee_id, 'sgs2' );
    gen_xl_xml.write_cell_char( r,3, rec.first_name, 'sgs3' );
    gen_xl_xml.write_cell_char( r,4, rec.last_name , 'sgs4' );
    gen_xl_xml.write_cell_num( r,5, rec.salary );
    l_sum := l_sum + rec.salary ;
    END LOOP ;
    END LOOP ;
    gen_xl_xml.close_file ;
    END ;
    -----------------------------------------------------------------------------------------------------------------

  • Sending OS command from PL/SQL procedure

    "How can I send a operating system comand from PL/SQL procedure?
    I want to move , to copy , delete a file from a PL/sql procedure. i.e under unix send mv, cp or
    rm command";
    my e-mail is [email protected]

    take a look at
    http://asktom.oracle.com/pls/ask/f?p=4950:8:881946
    regards
    Freek D'Hooge
    "How can I send a operating system comand from PL/SQL procedure?
    I want to move , to copy , delete a file from a PL/sql procedure. i.e under unix send mv, cp or
    rm command";
    my e-mail is [email protected]

  • Passing data from Oracle stored procedures to Java

    We're going to write a new web interface for a big system based on Oracle database. All business rules are already coded in PL/SQL stored procedures and we'd like to reuse as much code as possible. We'll write some new stored procedures that will combine the existing business rules and return the final result dataset.
    We want to do this on the database level to avoid java-db round trips. The interface layer will be written in Java (we'd like to use GWT), so we need a way of passing data from Oracle stored procedures to Java service side. The data can be e.g. a set of properties of a specific item or a list of items fulfilling certain criteria. Would anyone recommend a preferable way of doing this?
    We're considering one of the 2 following scenarios:
    passing objects and lists of objects (DB object types defined on the schema level)
    passing a sys_refcursor
    We verified that both approaches are "doable", the question is more about design decision, best practice, possible maintenance problems, flexibility, etc.
    I'd appreciate any hints.

    user1754151 wrote:
    We're going to write a new web interface for a big system based on Oracle database. All business rules are already coded in PL/SQL stored procedures and we'd like to reuse as much code as possible. We'll write some new stored procedures that will combine the existing business rules and return the final result dataset.
    We want to do this on the database level to avoid java-db round trips. The interface layer will be written in Java (we'd like to use GWT), so we need a way of passing data from Oracle stored procedures to Java service side. The data can be e.g. a set of properties of a specific item or a list of items fulfilling certain criteria. Would anyone recommend a preferable way of doing this?
    We're considering one of the 2 following scenarios:
    passing objects and lists of objects (DB object types defined on the schema level)
    passing a sys_refcursor
    We verified that both approaches are "doable", the question is more about design decision, best practice, possible maintenance problems, flexibility, etc.
    I'd appreciate any hints.If logic is already written in DB, and the only concern is of passing the result to java service side, and also from point of maintenance problem and flexibility i would suggest to use the sys_refcursor.
    The reason if Down the line any thing changes then you only need to change the arguments of sys_refcursor in DB and as well as java side, and it is much easier and less efforts compare to using and changes required for Types and Objects on DB and java side.
    The design and best practise keeps changing based on our requirement and exisiting design. But by looking at your current senario and design, i personally suggest to go with sys_refcursor.

  • Ws-basic username inside pl/sql procedure published as web service

    I'm new to jdeveloper, but been working with Oracle for 13 years...
    We have used Jdevelper to expose a pl/sql procedure as a web service using the "Publish as web service..." wizard. We then used Web Services Manager in server agent mode to protect that web service using ws-basic header auth. OWSM does a lookup on the user supplied credentials against our active directory ldap server to determine if the user should be able to call the service. That all works, EXCEPT...
    The problem is that the stored procedure runs a query against data protected by virtual private database and extensive audit logs. We need access to the ws-basic credential from within oracle so that we can set the session context and pull the end-user's id for auditing purposes.
    Right now, all we know inside the stored procedure is the oracle username used to connect to the database. This is of course different from the one used to authenticate our user in the OWSM layer.
    The pl/sql procedure does not have a parameter to specify the user name, and even if it did, there is no way for us to verify that any user supplied parameter matches the credentials used in OWSM.
    So, I assume, I need to modify the code generated by the "Publish as web service" wizard and somehow pull the ws-basic credentials (just username) and push them into the Oracle session_context.
    Anyone have any sample code or advice on how to get access to ws-basic credentials or even any of the metadata on a certificate supplied to OWSM for authentication/authorization?

    I change p_action value ( before p_action => 'alta' ) now ( p_action => '"alta"' )
    res := Xxm_Web_Service_Client_Pkg.invoke(p_init_msg_list => FND_API.G_TRUE,
    p_url => 'http://198.137.253.178:7777/event/DefaultSystem/clienteService_RS',
    p_action => '"alta"',
    x_return_status => l_return_Status,
    x_msg_count => l_msg_count,
    x_msg_data => l_msg_data,
    x_req => req)
    And the invokation an ESB service from a PLSQL procedure began to work fine !!!
    Thanks for all answers
    Thans Peter !!!
    Claudio

  • Problem creating a PDF from the "print view" of a web page

    When creating a PDF from the "print view" of a web page, the features in the print dialog box overlap. When the PDF is created, the words are garbled. e.g. words apppear as jzhhhxxf or zxihcj.

    Use a job settings that embeds the fonts. If you look at the PDF, the font properties probably do not look correct and don't include embedded fonts. Also, set the printer to Adobe PDF before you try to do a print, so that the web page can try to properly adjust to the printer.
    Why not just try opening the web site directly in Acrobat?

Maybe you are looking for

  • Sending email using apple script...

    I have created a watch folder using apple script that when a file is dropped on it, it automatically opens, formats, and sends out a custom email. What I don't understand is, how can I include multiple variables in the "content" section (also known a

  • Help with Purchasing new Macbook Pro

    I have decided on going with the new 17in model. What I am havening problems deciding is if I should get the 5400 or 7200 rpm drive after reading all of the posts here. I was originally going to get the 7200 but am now leaning towards the 5400. Is an

  • Is there a way to edit the same RAW file in Aperture 3 and then Photoshop CS5?

    I recently got Aperture 3.4.5 and its been great for stream-lining my workflow.  But for certain RAW adjustments, like applying a gradient, I want to use Photoshop CS5's RAW editing window.  I don't seem to be able to export the file as a modified CR

  • Apple DVD PLAYER ERROR

    After installing 10.5, opening Dvd player i received this error There was an initialization error A valid video device could not be found for playback [-70017] I've searched all over the forums with no solutions. i know its not a big problem with leo

  • Item master synchronisation from third party system to SAP

    Hello , I would like to understand how we can desgin flow of data in case of changes in Catalog from third party system to SAP. We have implemented Catalog functionality.  Catalog maintained in third party system is accessed from SAP for procurement