Oracle PL/SQL type defined within a package can't be passed from JAVA

Hello,
I am trying to create an Oracle ArrayDescriptor in order to receive a colloection element of type "TABLE".
The PL/SQL array type is defined in a package - the array descriptor creation fails.
The type is created within a package call MyPackage
TYPE SERVERLIST IS TABLE OF VARCHAR2(50);
I try to create the ArrayDescriptor using MyPackage.SERVERLIST but it fails with the message:
java.sql.SQLException: invalid name pattern: MyPackage.SERVERLIST
If I create the SERVERLISTtype at the database level - everything works. The problem is that we have a requirement not to pollute the global namespeace with our types, so I can't create the type at the top level.
I got no input from the Oracle JDBC tean - so any ideea would be very much appreciated.
Database is Oracle 8.1.7
And I am using oracle-jdbc thin driver.

This is only possible, when u define ur custom type globally. The reason being, in JDBC code when u define struct statement, the code with db connection in constructor finds that if the custom type is present in DB , it does not search in specific procedure, so it would only get this , if ur cuustom type is defined globally.
--Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • How to call a stored procedure that use a type defined in a package?

    Hi all,
    this is stored procedure:
    GET_GIORNATAEVENTO( in_nome_servizio IN VARCHAR2,
    out_dati_aggiornati OUT TAB_VARCHAR2);
    TAB VARCHAR2 is defined in the package specification:
    TYPE tab_varchar2 IS TABLE OF VARCHAR2(5) INDEX BY BINARY_INTEGER;
    and this is the name of the package: PKG_SERVIZI_MMSPUSH.
    This is my php script:
    <?php
    // Connect to database...
    $c=OCILogon("venus_vfl", "venus_vfl", "venvi");
    if ( ! $c ) {
    echo "Connessione non riuscita: " . var_dump( OCIError() );
    die();
    echo "<br>PKG_SERVIZI_MMSPUSH.GET_GIORNATAEVENTO</br> ";
    echo "<br> </br>";
    // Call database procedure...
    $in_servizio = "MOTO";
    $s = OCIParse($c, "begin PKG_SERVIZI_MMSPUSH.GET_GIORNATAEVENTO(:bind1, :bind2); end;");
    OCIBindByName($s, ":bind1", $in_servizio);
    OCIBindByName($s, ":bind2", $out_esito);
    OCIExecute($s,OCI_DEFAULT);
    echo "OUT_DATI_AGGIORNATI= " . $out_esito;
    // Logoff from Oracle
    OCILogoff($c);
    ?>
    How to test stored procedure to get the output parameter?
    Thanks in advance.

    Thanks,
    but I need to test stored procedures that uses type defined in the package.
    e.g.
    if I have s.p.
    PROCEDURE get_risultati_squadra
    ( in_squadra IN VARCHAR2,
    out_serie OUT tab_varchar2_5,
    out_tiporisultato OUT tab_varchar2_5,
    out_n_giornata OUT tab_varchar2_5,
    out_squadre OUT tab_varchar2_200,
    out_risultato OUT tab_varchar2_10,
    out_marcatore OUT tab_varchar2_50,
    out_punti OUT tab_varchar2_3,
    out_rimbalzista OUT tab_varchar2_50,
    out_rimbalzi OUT tab_varchar2_3,
    out_esito OUT tab_varchar2_2);
    I have to define every type external to the package, in this case five new TYPE !!
    Is there another way to solve this problem?
    Thanks

  • Can we create a StructDescriptor for a pl/sql Type declared in a Package?

    Hi,
    I went thru many threads on the forum regarding passing Structs and Arrays from java to pl/sql and back. In one of the threads, Tom Trevor has asked this question, but I do not see any definitive answer there. (if it's there, maybe I didn't get it).
    I want to refer to a pl.sql Type (Record) declared inside a package while creating a StructDescriptor. Is this possible?

    This is only possible, when u define ur custom type globally. The reason being, in JDBC code when u define struct statement, the code with db connection in constructor finds that if the custom type is present in DB , it does not search in specific procedure, so it would only get this , if ur cuustom type is defined globally.
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Data passed from Java to a PL/SQL function

    OK, I am at the beginner-to-intermediate level when it comes to PL/SQL...and a virtual novice when it comes to Java, so please forgive me if my question seems strange or naive.
    We are developing a Java-based web app. Some of the screens are reminiscent of a spreadsheet-type layout--potentially LOTS of rows and LOTS of columns (actually, an open-ended # of rows/columns--the rows represent a particular 'thing' and the columns represent the dates on which that 'thing' occurred), where the user can check off any and all the cells that apply. We are also 'auditing' all database activity (who did what to the data, and when). The approach we have chosen is as follows: When the user clicks save, the first thing we do is 'inactivate' all of the existing active rows in the db for that screen, whether or not they have changed(i.e., there is an 'active' flag that we set to false & we also save the user id of the person making the change and the date time of the change). Then the Java code calls the database once per row/contiguous column unit. For instance, on a single row, if the user checks off columns 1-4 and 7-15 and column 21 the Java code will send three calls to the database for that row with info about the start/stop column for each unit.
    OK--here is my concern...the majority of the time there will be a reasonably small #of 'units'. Occasionally there will be a moderate, and once in awhile a LARGE # of 'units'. So, let's take an extreme case and say that currently the db has 200 such row/contiguous column units for a given screen. The user goes into that screen and adds the 201st unit, then clicks Save. Java calls the db to first inactivate the 200 rows. Then one by one Java calls the db to add the rows back in, only on row #40, the internet connection is lost. The only way the user can tell what happened is to look at the entire screen and reverify ALL the data in order to tell what got saved/resaved and what didn't. Obviously this is a bad situation that we want to avoid.
    I should add that the reason this approach was chosen is that the Java developers thought it would be way too complex in this situation to track the changes the user made on the screen, sort out what has been added/modified/deleted, and only call the db for changes.
    So given this background, can anyone offer any suggestions/ideas on how we can prevent unintended data loss given the auditing constraints and concern about minimizing complexity on the Java side (redesigning the GUI screen is NOT an option, as the users are very attached to this design)?
    Is there a way for Java to pass a multidimensional (& variable-sized) array to a PL/SQL function? Can Oracle's complex (row, table) data types be used in a function's parameter string, and if so...how?...Or else is there some way we can send a single call to the db on a screen like this one? We thought of calling the db once and sending one very large string packed with all the data (could get very big, not sure of Oracle's limatations on passed data--is it 32K for varchar2? )
    Advice, ideas, even random thoughts would be greatly appreciated!

    Tracy,
    <quote>… only on row #40, the internet connection is lost. The only way the user can tell what happened is to look at the entire screen and reverify ALL the data in order to tell what got saved/resaved and what didn't</quote>
    That would be "the only way" if the Java programmers had decided to totally bury the error … what should happen here is the end-user should get a proper error message … no need to re-verify at this point since all bets are off (in fact, nothing should’ve been changed in the database).
    Nonetheless, your concerns regarding the chosen approach are valid … making multiple calls to the database after a Save makes controlling a business transaction rather complex (in an n-tier system) … they should make one call only to the database passing in all the data to be saved … one database transaction … either all changes get applied or none.
    The fact that lots of data may need to be passed in for one Save is of no relevance … if you have to carry 500Kb of data for that screen then, well, you have to do it … 1 bucket of 500Kb or 50 buckets of 10Kb? … it doesn’t really matter as far as the actual transport part is concerned.
    As already answered, one can pass complex types in pl/sql … so one database call per Save would be my first random thought. There are lots of suspect things in here … some things you didn’t mentioned at all … like how is concurrency addressed? … have you/they implemented some sort of optimistic locking mechanism? Of course the architecture of your system won’t be solved in a forum … so, finding a good system/data/Oracle architect on site for the project would be my second random thought.
    PS. One last random thought … fight off that idea of packing and sending large strings (XML or not) … if the data is structured then contemplate XML for no more than few seconds.

  • Killing a sql script in process - and I can't go on from there

    Hey there.
    I did a search on this, but couldn't find exactly what's happening - although I'm sure others know the answer to this.
    When I'm running a SQL statement (just a line, not as a script)j and then hit the red X to stop, I can't change the script anymore. Also, trying a rollback makes no diff.
    Any idea what to do at this point?

    A couple of things...if your script contained DDL or Commits, then no rollback can happen.
    There were a few bugs logged about the kill process hanging, and they have been addressed for 1.1. The particular issue raised, i.e. you stop/kill a script and then can't edit it anymore has been logged and fixed for 1.1.
    In addition, a number of features have been added to help you with long running scripts.
    Sue

  • Parameters passing from java to oracle forms

    How can i pass parameters out of a java environment, and into an
    oracle forms(6i) environment?
    we run on db 9i
    on windows xp.
    thanks
    yair

    Dipankar,
    There's a separate example of how to map Oracle OBJECTs to JDBC STRUCTs.
    Study that one and combine the two. Not difficult (in my opinion :-)
    Or search the JDBC forum for the words "STRUCT" and "ARRAY".
    (What, you want me to do your coding for you?)
    Good Luck,
    Avi.

  • Type of stylus for iPad2 -- can I use one from a Treo

    I have some old styluses from an old smart phone (Treo?) and wanted to know the specs for one to use for an iPad2.  i.e., can I use that old soft-tipped stylus for my iPad2?  How do I know which ones are "safe"?
    Thank you,
    Ron

    The Treo used a different type of touch screen. The stylus won't work on the iPad. There are lots of different brands out there. Just search Amazon for iPad Stylus. It's important to note that any stylus that works with the iPad's capacitive touch screen will have a fairly wide, soft tip.

  • DataObject defined into uix page. Can I get it from Java event handler?

    I have in my uix page following code:
    <dataScope>
    <provider>
    <data name="MyDataObject">
    <method class="mypackage.MyClass" method="getMyDataObject"/>
    </data>
    </provider>
    <contents>
    Can I get "MyDataObject" inside
    public static EventResult handlerSearch(BajaContext context, Page page, PageEvent event)
    Thank you.

    Only by directly accessing mypackage.MyClass.getMyDataObject(), it's not
    available on the BajaContext.

  • Generate Java class from Oracle Type defined in Package w/ JPublisher

    I was wondering if its possible to generate a Java class for an Oracle Type defined in a Package? I know passing the package name to JPublisher (SQL <package_name>) causes all Oracle Types in the Package to have a Java class generated for them but I'd like to be able to do this for an individual Type defined in a Package (something like SQL <package_name>.<type_name>).
    Thanks for any information you can give me.

    Hi Marinel,
    The support for XSD import is limited on 10.1.2. If you can, you should consider moving to the 10.1.3 preview as the support for document style web services has improved. The other option will be to inline the schema in your WSDL.
    Eric.

  • DBMS_SQL.PARSE with PL/SQL types

    Hi
    I need to use DBMS_SQL.PARSE with PL/SQL types defined in a package.
    I tried with a type record in a declare ..begin..end  script but I got an error ..(on second parameter):
    DBMS_SQL.PARSE(cursor_name, XXXXX, DBMS_SQL.NATIVE);
    It's possible?
    WIth SQL types defined at schema level it's works (es. Objects types) .
    If it's not possible, how can I resolve?
    Stefano

    Again, please post what XXXXX is. In order to use package declared types:
    SQL> create or replace
      2    package pkg1
      3      is
      4        type emp_rec
      5          is record (
      6                     empno number,
      7                     ename varchar2(10)
      8                    );
      9        type emp_rec_tbl
    10          is
    11            table of emp_rec
    12            index by pls_integer;
    13        g_emp_rec_tbl pkg1.emp_rec_tbl;
    14  end;
    15  /
    Package created.
    SQL> declare
      2      v_cur integer;
      3      v_sql varchar2(1000);
      4  begin
      5      v_cur := dbms_sql.open_cursor(2);
      6      v_sql := 'begin
      7                    select  empno,
      8                            ename
      9                      bulk  collect
    10                       into  pkg1.g_emp_rec_tbl
    11                       from  emp
    12                       where job = ''CLERK'';
    13                end;';
    14      dbms_sql.parse(
    15                     v_cur,
    16                     v_sql,
    17                      dbms_sql.native
    18                     );
    19  end;
    20  /
    PL/SQL procedure successfully completed.
    SQL>
    SY.

  • Referencing package table type from Java

    Hi,
    In my package spec, I have a table type defined. I just want to refer this from Java program in order to pass ARRAY object to a procedure inside the package. But I keep getting an errory saying "Invalid name pattern".
    But If I declare the type outside of the package, it works fine. Can anyone help me on this?
    Regards,
    Poornachandran R

    Hi,
    create or replace package msproot.spear$util as
    -- UUID table type
    type varchar32_t is table of varchar2(32) index by binary_integer;
    * Function name: getUUID
    * Desc: Retreive a unique id.
    * IN: maxNumOfUUID - integer, the quentity of UUID to generate, optional default 1.
    * OUT: UUID - an array of 32 characters string of UUID
    function getUUID(maxNumOfUUID number :=1 ) return varchar32_t;
    end spear$util;
    create or replace package body msproot.spear$util as
    -- get uuid - retun more the one UUID
    function getUUID(maxNumOfUUID number) return varchar32_t is
    uuidArr varchar32_t;
    begin
    -- generate the array of uuid up to maxNumOfUUID
    for i in 1..maxNumOfUUID loop
    select sys_guid into uuidArr(i) from dual;
    end loop;
    return (uuidArr);
    end getUUID;
    end spear$util;
    private String[] retrieveUuid(int maxNumOfUUID) throws Exception
    String[] arr = null;
    try {
    // generate a free spear ids array from the database
    // Use a PL/SQL block to open the stored procedure
    OracleCallableStatement ocstmt =
    (OracleCallableStatement) conn
    .prepareCall("begin ? := spear$util.getUUID(?); end;");
    // index-by table element type
    int elemSqlType = OracleTypes.CHAR;
    // index-by table element length in case the element type
    // is CHAR, VARCHAR or RAW. This value is ignored for other
    // types
    int elemMaxLen = 32;
    // register the return parameter
    ocstmt.registerIndexTableOutParameter(1, maxNumOfUUID, elemSqlType,
    elemMaxLen);
    // register the number of UUIDes to generate
    ocstmt.setInt(2, maxNumOfUUID);
    // run the stored procedure
    ocstmt.execute();
    // access the value using JDBC default mapping
    arr = (String[]) ocstmt.getPlsqlIndexTable(1);
    // close the cursor
    ocstmt.close();
    } catch (SQLException x) {
    System.out.println(errorMessage + x.toString());
    throw new Exception(errorMessage + x.getMessage());
    return arr;
    Best,
    EA

  • SQL User Defined Functions for performing statistical calculations

    Hi!
       I hope you can help.  I just wasn’t sure where to go with this question, so I’m hoping you can at least point me in the right direction.
       I’m writing a SQL Server stored procedure that returns information for a facility-wide scorecard-type report.  The row and columns are going to be displayed in a SQL Server Reporting Services report. 
       Each row of information contains “Current Month” and “Previous Month” numbers and a variance column.  Some rows may compare percentages, others whole numbers, others ratios, depending on the metric they’re measuring.  For each row/metric the company has specified whether they want to see a t-test or a chi-squared statistical test to determine whether or not there was a statistically significant difference between the current month and the previous month. 
       My question is this:  Do you know where I can find a set of already-written user defined functions to perform statistical calculations beyond the basic ones provided in SQL Server 2005?  I’m not using Analysis Services, so what I’m looking for are real SQL User Defined Functions where I can just pass my data to the function and have it return the result within a stored procedure. 
       I’m aware that there may be some third-party statistical packages out there we could purchase, but that’s not what I’m looking for.   And I’m not able to do anything like call Excel’s analysis pack functions from within my stored procedure.   I’ve asked.   They won’t let me do that.   I just need to perform the calculation within the stored procedure and return the result.
       Any suggestions?  Is there a site where people are posting their SQL Server UDF’s to perform statistical functions?  Or are you perhaps aware of something like a free add-in for SQL that will add statistical functions to those available in SQL?   I just don’t want to have to write my own t-test function or my own chi-squared function if someone has already done it.
     Thanks for your help in advance!  Oh, and please let me know if this should have been posted in the TSQL forum instead.  I wasn't entirely sure.
    Karen Grube

    STATS_T_TEST_
    docs.oracle.com/cd/B19306_01/server.102/b14200/functions157.htm 
    STATS_T_TEST_ONE: A one-sample t-test
    STATS_T_TEST_PAIRED: A two-sample, paired t-test (also known as a crossed t-test)
    STATS_T_TEST_INDEP: A t-test of two independent groups with the same variance (pooled variances)
    STATS_T_TEST_INDEPU: A t-test of two independent groups with unequal variance (unpooled variances)

  • Records and Objects, Cast for PL/SQL Type RECORD and SQL Type OBJECT

    Hi seniors:
    In my job, we have Oracle 10g, programming with Packages, the parameters are PL/SQL Types,
    Example:
    PACKAGE BODY NP_CONTROL_EQUIPMENT_PKG
    IS
    TYPE TR_EQUIPMENT_OPERATION IS RECORD(
    wn_npequipmentoperid CONTROL_EQUIPMENT.NP_EQUIPMENT_OPERATIONS.npequipmentoperid%TYPE,
    wv_npactiveservicenumber CONTROL_EQUIPMENT.NP_EQUIPMENT_OPERATIONS.npactiveservicenumber%TYPE,
    wv_npspecification ORDERS.NP_SPECIFICATION.npspecification%TYPE,
    wv_nptype ORDERS.NP_SPECIFICATION.nptype%TYPE,
    wn_nporderid CONTROL_EQUIPMENT.NP_EQUIPMENT_OPERATIONS.nporderid%TYPE,
    wn_npguidenumber CONTROL_EQUIPMENT.NP_EQUIPMENT_OPERATIONS.npguidenumber%TYPE,
    wd_npdevolutionprogramdate CONTROL_EQUIPMENT.NP_EQUIPMENT_STATUS.npdevolutionprogramdate%TYPE
    TYPE TT_TR_EQUIPMENT_OPERATION_LST IS TABLE OF TR_EQUIPMENT_OPERATION INDEX BY BINARY_INTEGER;
    PROCEDURE SP_GET_EQUIPMENT_OPERATION_LST(
    an_npequipstatid IN CONTROL_EQUIPMENT.NP_EQUIPMENT_STATUS.npequipstatid%TYPE,
    at_equipment_operation_list OUT TT_TR_EQUIPMENT_OPERATION_LST,
    av_message OUT VARCHAR2
    IS
    BEGIN
    SELECT EO.npequipmentoperid,
    EO.npactiveservicenumber,
    S.npspecification,
    S.nptype,
    EO.nporderid,
    EO.npguidenumber,
    ES.npdevolutionprogramdate
    BULK COLLECT INTO at_equipment_operation_list
    FROM NP_EQUIPMENT_OPERATIONS EO,
    NP_EQUIPMENT_STATUS ES,
    ORDERS.NP_ORDER O,
    ORDERS.NP_SPECIFICATION S
    WHERE EO.npequipstatid = ES.npequipstatid
    AND EO.nporderid = O.nporderid
    AND O.npspecificationid = S.npspecificationid
    AND EO.npequipstatid = an_npequipstatid;
    EXCEPTION
    WHEN OTHERS THEN
    av_message := 'NP_CONTROL_EQUIPMENT_PKG.SP_GET_EQUIPMENT_OPERATION_LST: '||SQLERRM;
    END SP_GET_EQUIPMENT_OPERATION_LST;
    END;
    Procedures calls other procedures and passing parameters IN OUT defined that PL/SQL Types. The problem appears when the access is through Java. Java can't read PL/SQL Types because only read SQL Types (Types defined in SCHEMA):
    CREATE OR REPLACE
    TYPE TO_EQUIPMENT_OPERATION AS OBJECT (
    wn_npequipmentoperid NUMBER,
    wv_npactiveservicenumber VARCHAR2(15),
    wv_npspecification VARCHAR2(8),
    wv_nptype VARCHAR2(2),
    wn_nporderid NUMBER,
    wn_npguidenumber NUMBER,
    wd_npdevolutionprogramdate DATE
    CREATE OR REPLACE
    TYPE TT_EQUIPMENT_OPERATION_LST
    AS TABLE OF "CONTROL_EQUIPMENT"."TO_EQUIPMENT_OPERATION"
    Java can read this SQL Types. The problem is how cast OBJECT to RECORD, because I can't execute that:
    DECLARE
    wt_operation_lst TT_EQUIPMENT_OPERATION_LST;
    BEGIN
    SELECT EO.npequipmentoperid,
    EO.npactiveservicenumber,
    S.npspecification,
    S.nptype,
    EO.nporderid,
    EO.npguidenumber,
    ES.npdevolutionprogramdate
    BULK COLLECT INTO wt_operation_lst
    FROM NP_EQUIPMENT_OPERATIONS EO,
    NP_EQUIPMENT_STATUS ES,
    ORDERS.NP_ORDER O,
    ORDERS.NP_SPECIFICATION S
    WHERE EO.npequipstatid = ES.npequipstatid
    AND EO.nporderid = O.nporderid
    AND O.npspecificationid = S.npspecificationid
    AND EO.npequipstatid = an_npequipstatid;
    END;
    and throws NOT ENOUGH VALUES, and I modified to:
    DECLARE
    wt_operation_lst TT_EQUIPMENT_OPERATION_LST;
    BEGIN
    SELECT TO_EQUIPMENT_OPERATION(EO.npequipmentoperid,
    EO.npactiveservicenumber,
    S.npspecification,
    S.nptype,
    EO.nporderid,
    EO.npguidenumber,
    ES.npdevolutionprogramdate)
    BULK COLLECT INTO wt_operation_lst
    FROM NP_EQUIPMENT_OPERATIONS EO,
    NP_EQUIPMENT_STATUS ES,
    ORDERS.NP_ORDER O,
    ORDERS.NP_SPECIFICATION S
    WHERE EO.npequipstatid = ES.npequipstatid
    AND EO.nporderid = O.nporderid
    AND O.npspecificationid = S.npspecificationid
    AND EO.npequipstatid = an_npequipstatid;
    END;
    Worst is that I can't modify this procedure and PL/SQL Types will survive.
    I have create a copy that CAST RECORD to OBJECT and OBJECT to RECORD too.
    PROCEDURE SP_COPY_PLSQL_TO_SQL(
    an_npequipstatid IN NUMBER,
    at_dominio_lst OUT ORDERS.TT_EQUIPMENT_OPERATION_LST, --SQL Type
    av_message OUT VARCHAR2
    IS
    wt_dominio_lst CONTROL_EQUIPMENT.NP_CONTROL_EQUIPMENT_PKG.TT_TR_EQUIPMENT_OPERATION_LST; --PL/SQL Type
    BEGIN
    SP_GET_EQUIPMENT_OPERATION_LST(an_npequipstatid, wt_dominio_lst, av_message);
    IF av_message IS NULL THEN
    at_dominio_lst := ORDERS.TT_EQUIPMENT_OPERATION_LST(ORDERS.TO_EQUIPMENT_OPERATION('','','','','','',''));
    at_dominio_lst.EXTEND(wt_dominio_lst.COUNT - 1);
    FOR i IN 1..wt_dominio_lst.COUNT LOOP
    at_dominio_lst(i) := ORDERS.TO_EQUIPMENT_OPERATION(wt_dominio_lst(i).wn_npequipmentoperid,
    wt_dominio_lst(i).wv_npactiveservicenumber,
    wt_dominio_lst(i).wv_npspecification,
    wt_dominio_lst(i).wv_nptype,
    wt_dominio_lst(i).wn_nporderid,
    wt_dominio_lst(i).wn_npguidenumber,
    wt_dominio_lst(i).wd_npdevolutionprogramdate
    END LOOP;
    END IF;
    END;
    I would like that the CAST is direct. Somebody can help me?. Thank you so much!

    I am facing the same problem as u had...may I know how u solved ur probkem...
    thanks,
    kishore

  • How can i migrate Power Builder 8.0 Function into oracle PL/SQL

    Hi Oracle Experts...
    How can i migrate Power Builder 8.0 Function into oracle PL/SQL.. I had migrate some of the coding from PB to PL/SQL. But i don't know how can i convert PB structure(here structure is a data type) into oracle PL/SQL.
    Instead of structure what is the equivalent in oracle plsql
    Below i pasted my POWER BUILDER FUNCTION:
    Long ll_perd,ll_lnperd,ll_mon,ll_effmon,ll_instno,ll_odno
    Decimal{5} ldl_actual,ldl_diff,ldl_inst
    Datetime ldt_first,ldt_exp,ldt_oddt, ldt_lastprod
    String ls_instmode,ls_inst
    str_batch lstr_od //Structure to store odamt and oddate
    Select pay_c_final,lon_d_expiry, lon_d_lastprod
    Into     :ls_inst,:ldt_exp, :ldt_lastprod
    From      loan_mast
    Where branch_c_code = :gs_branch and
              act_c_type      = :as_actype and
              act_c_no           = :as_acno;
    If Sqlca.Sqlcode = -1 Then
         f_message('FT-0189',Sqlca.Sqlerrtext)
         lstr_od.batchslno = -1
         Return lstr_od
    End If
    If adt_prodt > ldt_exp Then
         Select Ceil(months_between(:adt_prodt,:ldt_exp)) Into :lstr_od.batchslno From dual;
         lstr_od.cheqdt = ldt_exp
         lstr_od.batchslno = DaysAfter(Date(ldt_lastprod), Date(adt_prodt))
    Else
         If ls_inst = 'N' Then
              If adt_prodt > ldt_exp Then
                   Select Ceil(months_between(:adt_prodt,:ldt_exp)) Into :lstr_od.batchslno From dual;
                   lstr_od.cheqdt = ldt_exp
              Else
                   lstr_od.batchslno = 1
              End If
         ElseIf ls_inst = 'Y' Then
              Select first_d_due,lon_c_instperd,lon_n_perd
              Into     :ldt_first,:ls_instmode,:ll_lnperd
              From     loan_mast
              Where branch_c_code = :gs_branch and
                        act_c_type      = :as_actype and
                        act_c_no          = :as_acno;
              If Sqlca.Sqlcode = -1 Then
                   f_message('FT-0189',Sqlca.Sqlerrtext)
                   lstr_od.batchslno = -1
                   Return lstr_od // Return Structure
              End If
              Select Ceil(months_between(:adt_prodt,:ldt_first)) Into :ll_mon from dual;
              If ll_mon > 0 Then
                   Select Nvl(ln_n_balance,0),Nvl(ln_n_instlamt,0),Nvl(ln_n_instlno,0)
                   Into     :ldl_actual,:ldl_inst,:ll_instno
                   From     loan_inst_sch
                   Where act_c_type = :as_actype and
                             act_c_no     = :as_acno and
                             ln_d_effdate = (Select Max(ln_d_effdate)
                                                           From     loan_inst_sch
                                                           Where act_c_type = :as_actype and
                                                                     act_c_no     = :as_acno and
                                                                     ln_d_effdate < :adt_prodt);
                   If Sqlca.Sqlcode = -1 Then
                        f_message('FT-0224', Sqlca.Sqlerrtext)
                        lstr_od.batchslno = -1
                        Return lstr_od
                   ElseIf Sqlca.Sqlcode = 100 Then
                        lstr_od.batchslno = 1
    *                    Return lstr_od*
                   End If
                   If adl_bal > ldl_actual Then
                        If ldl_inst > 0 Then
                             lstr_od.batchslno = (adl_bal - ldl_actual) / ldl_inst
                        End If
                   Else
                        lstr_od.batchslno = 1
                   End If     
                   If lstr_od.batchslno = 0 Then lstr_od.batchslno = 1
                   //For full OD
                   If ll_mon > ll_lnperd Then
                        lstr_od.batchslno = (ll_mon - ll_lnperd) + lstr_od.batchslno
                   End If
                   If ls_instmode = 'Q' Then
                        lstr_od.batchslno = lstr_od.batchslno * 3
                   ElseIf ls_instmode = 'H' Then
                        lstr_od.batchslno = lstr_od.batchslno * 6
                   ElseIf ls_instmode = 'Y' Then
                        lstr_od.batchslno = lstr_od.batchslno * 12
                   End If
                   Select :adt_prodt - :lstr_od.batchslno Into :lstr_od.cheqdt From dual;
                   If ls_instmode = 'M' Then
                        ll_odno = ll_instno - lstr_od.batchslno // To get OD Date
                        Select ln_d_effdate
                        Into     :lstr_od.cheqdt
                        From     loan_inst_sch
                        Where act_c_type = :as_actype and
                                  act_c_no     = :as_acno and
                                  ln_n_instlno = :ll_odno;
                        If Sqlca.Sqlcode = -1 Then
                             f_message('FT-0224', + Sqlca.Sqlerrtext)
                             lstr_od.batchslno = -1
                             Return lstr_od
                        End If
                   End If
              Else
                   lstr_od.batchslno = 1
              End If
         End If
    End if
    Return lstr_od
    Thanks in adance
    Arun M M

    What are you going to return the structure to? What I would normally use here if the code was going to be used by other PL/SQL would be a PL/SQL object type.
    However, if PowerBuilder is still in the equation (you're moving the logic to PL/SQL but keeping PowerBuilder for the GUI ), then you'll have to return something else, because PowerBuilder doesn't understand PL/SQL object types. Perhaps passing a REF CURSOR as a OUT argument and populating it from the procedure. PowerBuilder could then retrieve the result of the procedure using a stored procedure based DataWindow.

  • Java.sql.types and oracletypes

    There appear to be difference in the way the constants are mapped in java.sql.types vs oracletypes(). For example date is '91' in oracletypes and '93' in java.sql.types. The DatabaseMetaData.getColumns() function reports data_type as a java.sql.type. Is there any mapping available from one to the other.
    Thanks

    Erm,
    One way to find out, I reckon.
    Good Luck,
    Avi.

Maybe you are looking for