Help with VARRAY in PL/SQL

I wrote the below Stored Procedure in a package. I am not able to execute this, can anyone please help
Package Definition:
CREATE OR REPLACE PACKAGE "CDS_SUBLIMIT_TYPE_PKG" as
TYPE COLLATERAL_ARRAY is VARRAY(100) OF NUMBER(29);
procedure get_original_balance_array_p(in_collateral_id IN NUMBER, l_data OUT COLLATERAL_ARRAY );
end CDS_SUBLIMIT_TYPE_PKG;
Package Body:
CREATE OR REPLACE PACKAGE BODY "CDS_SUBLIMIT_TYPE_PKG" as
procedure get_original_balance_array_p
(in_collateral_id IN NUMBER, l_data OUT COLLATERAL_ARRAY ) IS
CURSOR c_collateral IS
SELECT collateral_id FROM collateral where rownum < 10;
BEGIN
l_data:=COLLATERAL_ARRAY();
FOR collateral_rec IN c_collateral LOOP
l_data.extend;
l_data(l_data.count):=collateral_rec.collateral_id;
END LOOP;
l_data.extend;
l_data(l_data.count):=in_collateral_id;
END get_original_balance_array_p;
end CDS_SUBLIMIT_TYPE_PKG;
Execution:
declare
collateral_id number;
collectionId collateral_array;
begin
collateral_id:=55;
CDS_SUBLIMIT_TYPE_PKG.get_original_balance_array_p(collateral_id, collectionId);
end;

collectionId collateral_array;You missed out the package name - it should be
collectionId cds_sublimit_type_pkg.collateral_array;VARRAYs are good as multivalue columns in database tables, if you're into that (I'm not particularly). In PL/SQL code, nested tables have more functionality, especially in 10g.
www.williamrobertson.net/documents/collection-types.html

Similar Messages

  • Help with "ORA-06511: PL/SQL: cursor already open"

    I've tried numerous variations on this piece of code and I always get the same result. I'm sure this is painfully obvious to an experienced PL/SQL person.
    Any help will be appreciated!
    Thank You!
    1 DECLARE
    2 CURSOR EMP_CURSOR IS SELECT last_name from employees;
    3 current_last_name varchar2(25);
    4 BEGIN
    5 IF EMP_CURSOR%ISOPEN
    6 THEN
    7 dbms_output.put_line ('cursor is already open');
    8 close EMP_CURSOR;
    9 END IF;
    10 dbms_output.put_line ('opening cursor');
    11 OPEN EMP_CURSOR;
    12 FOR item in EMP_CURSOR LOOP
    13 FETCH EMP_CURSOR INTO current_last_name;
    14 EXIT WHEN EMP_CURSOR%NOTFOUND;
    15 dbms_output.put_line (item.last_name);
    16 END LOOP;
    17 CLOSE EMP_CURSOR;
    18* END;
    19 /
    DECLARE
    ERROR at line 1:
    ORA-06511: PL/SQL: cursor already open
    ORA-06512: at line 2
    ORA-06512: at line 12

    Mathieu,
    Log in as anotherSchema and grant select on 'IDsTable' to the current user.
    SQL> r
      1  create or replace function f1(theID varchar2) return mytype pipelined is
      2  out varchar2(30);
      3  cursor myCursor (x varchar2) is select * from scott.emp where job=x;
      4  begin
      5  for rec in myCursor(theID) loop
      6  pipe row(rec.ename);
      7  end loop;
      8  return;
      9* end;
    Warning: Function created with compilation errors.
    SQL> show errors
    Errors for FUNCTION F1:
    LINE/COL ERROR
    3/33     PL/SQL: SQL Statement ignored
    3/53     PL/SQL: ORA-00942: table or view does not exist
    6/1      PL/SQL: Statement ignored
    6/10     PLS-00364: loop index variable 'REC' use is invalid
    SQL> connect scott
    Enter password: *****
    Connected.
    SQL> grant select on emp to testuser;
    Grant succeeded.
    SQL> connect testuser
    Enter password: ****
    Connected.
    SQL> create or replace function f1(theID varchar2) return mytype pipelined is
      2  out varchar2(30);
      3  cursor myCursor (x varchar2) is select * from scott.emp where job=x;
      4  begin
      5  for rec in myCursor(theID) loop
      6  pipe row(rec.ename);
      7  end loop;
      8  return;
      9  end;
    10  /
    Function created.
    SQL> disconnect
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.3.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.3.0 - Production
    SQL>

  • Help with search within pl/sql code

    Hi All,
    Can you please help me to find all the objects with a database link.
    I have some procedures,function and packages which uses database link. I need to fetch all the objects that uses a database link. Is there any way to get the list of object names using any database link?
    Thanks in advance
    Apppreciate your help!
    Thanks
    Bob

    hi there,
    the problem with dba_source is that the code might be wrapped.
    another possibility is to query dba_dependencies, column referenced_link
    Also you can have pl/sql routines that create dynamically code and might use dblinks in their dynamic code.
    So you might not be able to be 100 percent complete.
    HTH Mathias

  • Help with escape option in sql

    SQL> select sname from shares where sname like 'VIS_%';
    SNAME
    VISAKAIND
    VISASTEEL
    VISESHINFO
    VISHALEXPO
    VISHALRET
    VISUINTL
    VIS_SIN
    7 rows selected.
    SQL> select sname from shares where sname like 'VIS\_%';
    SNAME
    VISAKAIND
    VISASTEEL
    VISESHINFO
    VISHALEXPO
    VISHALRET
    VISUINTL
    VIS_SIN
    7 rows selected.
    SQL> select sname from shares where sname like 'VIS_\%';
    SNAME
    VISAKAIND
    VISASTEEL
    VISESHINFO
    VISHALEXPO
    VISHALRET
    VISUINTL
    VIS_SIN
    7 rows selected.
    could u people please help me to get the row with the sname vis_sin only....

    Hi Sybrand - here it is - please point to the error
    if you see it...
    Thanks.
    Connected to:
    Oracle Database 10g Enterprise Edition Release
    10.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    SQL> select table_name from dba_tables where
    table_name like 'PS\_%' and rownum<10 escape '\';
    select table_name from dba_tables where table_name
    like 'PS\_%' and rownum<10 escape '\'
    ERROR at line 1:
    ORA-00933: SQL command not properly endedselect table_name from dba_tables where table_name like 'PS\_%' escape '\' and rownum < 10;
    the 'escape' is part of the like condition so you need it contiguous to the like clause.

  • I need help with network install of SQL Developer 3.2

    All,
    Does anyone have any references on how to perform a network install for SQL Developer? Here is what I'm trying to achieve:
    1. Network installation on drive S:\ (Windows, obviously)
    2. User links to network installation
    3. Connections are unique for each user
    I found the 2006 posting of network install for Raptor, but I could not find anything that correlates with the latest release. All I have done so far is downloaded and unzipped. Any help/instructions/guides/tutorials are welcome.

    You have installed!.  The code for SQLDeveloper does not have an installer.
    If the software is on S, say a shared drive, each user will start sqldeveloper and a directory called sqldeveloper  will be created in their local %APPLICATION_DATA% folder.  This will keep all connections etc unique for all users. 
    You will have to create a link from the S drive to the sqldeveloper.exe if you want a shortcut to start it.  We dont provide it.
    Thanks
    B

  • Help with Performance tunning PL/SQL

    Hi All,
    I have a PL/SQL procedure, it works fine. No errors, and no bugs. However its taking forever to finish. I am using the concatenation operator (||), and I know its expensive. How can I improve performance to the procedure ?
    Here is the code
    create or replace
    PROCEDURE POST_ADDRESS_CLEANSE AS
    CURSOR C1 IS
    SELECT Z.ROW_ID,
            Z.NAME
    FROM  STGDATA.ACCOUNT_SOURCE Z;
    CURSOR  C2 IS
    SELECT  DISTINCT CLEANSED_NAME || CLEANSED_STREET_ADDRESS ||
            CLEANSED_STREET_ADDRESS_2 || CLEANSED_CITY || CLEANSED_STATE ||
            CLEANSED_POSTAL_CODE AS FULLRECORD
    FROM    STGDATA.ACCOUNT_SOURCE_CLEANSED;
    V_ROWID Number := 1;
    V_FLAG VARCHAR2(30);
    TEMP_ROW_ID VARCHAR2(10) := NULL;
    BEGIN
      -- This loop will update CLEANSED_NAME column in ACCOUNT_SOURCE_CLEANSED table.
      FOR X IN C1 LOOP
        TEMP_ROW_ID := TO_CHAR(X.ROW_ID);
      UPDATE STGDATA.ACCOUNT_SOURCE_CLEANSED A
      SET  A.CLEANSED_NAME = X.NAME
      WHERE A.ROW_ID = TEMP_ROW_ID;
        COMMIT;
      END LOOP;
      -- This loop will update columns EM_PRIMARY_FLAG, EM_GROUP_ID in ACCOUNT_SOURCE_CLEANSED table
      FOR Y IN C2 LOOP
        UPDATE  STGDATA.ACCOUNT_SOURCE_CLEANSED
        SET     EM_GROUP_ID = V_ROWID
        WHERE   CLEANSED_NAME || CLEANSED_STREET_ADDRESS || CLEANSED_STREET_ADDRESS_2 ||
                CLEANSED_CITY || CLEANSED_STATE || CLEANSED_POSTAL_CODE = Y.FULLRECORD;
        UPDATE  STGDATA.ACCOUNT_SOURCE_CLEANSED
        SET     EM_PRIMARY_FLAG = 'Y'
        WHERE   CLEANSED_NAME || CLEANSED_STREET_ADDRESS || CLEANSED_STREET_ADDRESS_2 ||
                CLEANSED_CITY || CLEANSED_STATE || CLEANSED_POSTAL_CODE = Y.FULLRECORD
        AND     ROWNUM = 1;
        V_ROWID := V_ROWID + 1;
        COMMIT;
      END LOOP;
      UPDATE  STGDATA.ACCOUNT_SOURCE_CLEANSED
      SET     EM_PRIMARY_FLAG = 'N'
      WHERE   EM_PRIMARY_FLAG IS NULL;
      COMMIT;
      --dbms_output.put_line('V_ROW:'||V_ROWID);
      --dbms_output.put_line('CLEANSED_NAME:'||Y.FULLRECORD); 
    END POST_ADDRESS_CLEANSE;
    Thanks in advance.
    Message was edited by: Rooney -- added code using syntax highlight

    I was able to modify my code a bit, however I don't see a way of not using loops.
    In the loop, I am updating 2 columns. EM_PRIMARY_FLAG, and EM_GROUP_ID. The data I am working with has duplicate records, and that is why I am using a distinct in the cursor. The requirements are is to make one record a primary record, and the rest are reference records. What makes my record primary is updating column EM_PRIMARY_FLAG with a 'Y', and updating EM_GROUP_ID with a number combines all duplicate records into a group.
    In the procedure, I am getting the distinct records, looping through each one, and then doing 2 updates:
    1 - Update EM_PRIMARY_FLAG to 'Y' where rownum = 1, this will set one record to be primary
    2 - Update EM_GROUP_ID to a number (V_ROWID := V_ROWID + 1) where V_ROWID starts from 1, to group all records into a set.
    Here is my latest code after modifying it:
    create or replace
    PROCEDURE POST_ADDRESS_CLEANSE AS
    CURSOR  C1 IS
    SELECT      DISTINCT NVL(CLEANSED_NAME, '') AS NAME_CLEANSED,
                      NVL(CLEANSED_STREET_ADDRESS, '') AS ADDRESS_CLEANSED,
                      NVL(CLEANSED_STREET_ADDRESS_2, '') AS ADDRESS2_CLEANSED,
                      NVL(CLEANSED_CITY, '') AS CITY_CLEANSED,
                      NVL(CLEANSED_STATE, '') AS STATE_CLEANSED,
                      NVL(CLEANSED_POSTAL_CODE, '') AS POSTAL_CODE_CLEANSED
    FROM        STGDATA.ACCOUNT_SOURCE_CLEANSED;
    V_ROWID Number := 1;
    V_FLAG VARCHAR2(30);
    TEMP_ROW_ID VARCHAR2(10) := NULL;
    BEGIN
        UPDATE STGDATA.ACCOUNT_SOURCE_CLEANSED A
        SET  A.CLEANSED_NAME = (SELECT   Z.NAME
                                                       FROM     STGDATA.ACCOUNT_SOURCE Z
                                                       WHERE    Z.ROW_ID = (SELECT  TO_NUMBER(B.ROW_ID)
                                                                                           FROM    STGDATA.ACCOUNT_SOURCE_CLEANSED B
                                                                                           WHERE   B.ROW_ID = A.ROW_ID));
        COMMIT;
      -- This loop will update columns EM_PRIMARY_FLAG, EM_GROUP_ID in ACCOUNT_SOURCE_CLEANSED table
      FOR Y IN C1 LOOP
        UPDATE   STGDATA.ACCOUNT_SOURCE_CLEANSED
        SET          EM_GROUP_ID = V_ROWID
        WHERE    CLEANSED_NAME = Y.NAME_CLEANSED
        AND          CLEANSED_STREET_ADDRESS = Y.ADDRESS_CLEANSED
        AND          CLEANSED_STREET_ADDRESS_2 = Y.ADDRESS2_CLEANSED
        AND          CLEANSED_CITY = Y.CITY_CLEANSED
        AND          CLEANSED_STATE = Y.STATE_CLEANSED
        AND          CLEANSED_POSTAL_CODE = Y.POSTAL_CODE_CLEANSED;
        UPDATE  STGDATA.ACCOUNT_SOURCE_CLEANSED
        SET     EM_PRIMARY_FLAG = 'Y'
        WHERE   CLEANSED_NAME = Y.NAME_CLEANSED
        AND     CLEANSED_STREET_ADDRESS = Y.ADDRESS_CLEANSED
        AND     CLEANSED_STREET_ADDRESS_2 = Y.ADDRESS2_CLEANSED
        AND     CLEANSED_CITY = Y.CITY_CLEANSED
        AND     CLEANSED_STATE = Y.STATE_CLEANSED
        AND     CLEANSED_POSTAL_CODE = Y.POSTAL_CODE_CLEANSED
        AND     ROWNUM = 1;
        V_ROWID := V_ROWID + 1;
      END LOOP;
      COMMIT;
      UPDATE  STGDATA.ACCOUNT_SOURCE_CLEANSED
      SET     EM_PRIMARY_FLAG = 'N'
      WHERE   EM_PRIMARY_FLAG IS NULL;
      COMMIT;
    END POST_ADDRESS_CLEANSE;
    Thanks
    Message was edited by: Rooney - Just added the code in SQL block using syntax highlight.

  • Help with inserting values to sql database

    Hello everyone I am having this problem with how to fill my values in my sql statement, if you look below you will notice i have set up the values to be the length of the arr (arrayList).
    could someone please let me now how i should put there values in.
    thanks for yr time
    piper3
      try {
                                                    String data = "jdbc:odbc:myProject";
                                                        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                                                        Connection con = DriverManager.getConnection(data,"","");
                                                 StringBuffer sb = new StringBuffer();
                                                 Iterator it1 = arr.iterator();
                                                 while (it1.hasNext())
                                                      if (sb.length() > 0)
                                                           sb.append(",");
                                                           sb.append(it1.next());
                                                      //takes the items of the arInterim
                                                      //int iCountInterim = arInterim.size();
                                                      int er = arr.size();
                                                      String sInterim = new String();
                                                      String sql = new String();
                                                      for(int i2 = 0; i2 < er; i2++){
                                                           sInterim = sInterim + sQuestion;
                                                           if(i2 < (er-1)){
                                                                sInterim = sInterim + sComma;
                                                           sql = "INSERT into Ben (" + sb.toString() + ") values (" + sInterim + ")";
                                                           System.out.println(sql);
                                                           PreparedStatement prepStmt = con.prepareStatement(sql);
                                                           /*prepStmt.setString(1, "hello");
                                                           prepStmt.setString(2, "hi");
                                                           prepStmt.setString(3, "bye");
                                                           prepStmt.executeUpdate();
                                                           prepStmt.close();*/
                                                      con.close();               
                                                 } catch (Exception e1) {
                                                             System.err.println("Got an exception! ");
                                                             System.err.println(e1.getMessage());
                                                      //System.out.println();//.size());//tempkey+"\n"+tempvalue);

    you should write a prepared statement like this:
    PreparedStatement updateSales = con.prepareStatement(
    "UPDATE COFFEES SET SALES = ? WHERE COF_NAME LIKE ?");
    where "?" is a placeholder for the values you want to use.
    Then later when you want to actually update your database, first set the placeholders to your values (stored in your array for example) using a statement like this:
    updateSales.setString(2, "Colombian");
    //sets the 2. placeholder in the statement to the value "Colombian"
    after having set all placeholders to a specific value, execute your statement:
    updateSales.executeUpdate();
    your code should like:
    sql = "INSERT into Ben values (?,?,?)";
    PreparedStatement prepStmt = con.prepareStatement(sql);
    prepStmt.setString(1, "hello");
    prepStmt.setString(2, "hi");
    prepStmt.setString(3, "bye");
    prepStmt.executeUpdate();
    prepStmt.close();
    HTH
    Christine

  • Help With SUBSTR in dynamic SQL statement

    Following is the dynamic SQL statement.
    EXECUTE IMMEDIATE 'UPDATE table_name pml
    SET pml.'|| con_fields.field ||' = SUBSTR(pml.'||con_fields.field||' ||'' ''||
    (SELECT pml1.'||con_fields.field||'
    FROM table_name pml1
    WHERE pml1.grp_id = '||los_concats.grp_id ||'
    AND pml1.row_id = '||los_concats.row_id||'
    AND pml1.loser_flg = ''Y''),1, '||con_fields.max_length||')
    WHERE pml.grp_id = '||los_concats.grp_id ||'
    AND pml.loser_flg IS NULL ';
    what it does is that it updates a particular field. This field is concatenated by a field of a similar record.
    My problem is with SUBSTR function. Since I am concatenating fields I do not want the field to be updated greater than max_length on that field, the reason why I use SUBSTR. the select query inside SUBSTR works alright with one of the AND condition in a WHERE clause not present. When I add that additional condition it gives me this error.
    ORA-00907: missing right parenthesis.
    Is there any way to get around this problem. Does SQL has other than SUBSTR function which can limit the character length.
    Appreciate it.

    The other alternative I thought about was to do this first
    EXECUTE IMMEDIATE 'SELECT pml.'||con_fields.field||'
    FROM table_name pml
    WHERE pml.grp_id = '||los_concats.grp_id||'
    AND pml.row_id = '||los_concats.row_id||'
    AND pml.loser_flg = ''Y''
    ' INTO v_concat_field;
    write into the variable v_concat_field and then use it into the previous script.
    But on this I get SQL Command not properly terminated, I don't get it Why?
    Donald I tried with your suggested script. It works fine with one of the conditions eliminated. I don't understand what the error trying to say?
    Thanks

  • Help with Crystal Reports changing SQL Server

    I am doing a web site cutover to a new server for a client and have the server up and running using crystal reports server xi r2 sp2 under windows server 2003r2 32bit.
    When I run a report via the webpage it generates a blank page.
    I've edited the old web developers crystal report files and updated the database path howerver when i type in the new SQL server and authenticate to it using the SA account  it then pops up a window asking me to enter values
    has items such as
    @sUserID
    @sSubUserID
    @iSessionID
    etc
    the only way i can continue through this is to check a box for each value 'set to null' which i dont' think is correct.
    What values should I be putting in these areas or should I be getting this infomation from the previous developer?
    much appreciated

    Hello,
    I don't recognize those variables as CR ones so it's likely something the original developer is setting in code.
    You'll have to discuss with that person.
    If your have SDK issues then post your question to one of the .NET or Java SDK forums.
    Thank you
    Don

  • Help with a very slow sql statement

    Hi this statement takes 10 seconds to run and is run a lot, can anyone help me speed it up.
    Each section in itself is quick but when i add the IN section it slows down, probably because there is 20291 rows in the view v_allitems.
    anyone know how i can speed up?
    select ITEMTYPE,
    ITEMID,
    NOTESID,
    NOTES,
    DUEDATE,
    OPENDATE,
    SUBJECT,
    TYPE,
    STATUS,
    OWNER,
    CREATEBY,
    CREATEDATE,
    ITEMCODE
    FROM v_allitems
    where
    ITEMCODE in ( 'ACT,'||4264) OR ITEMCODE IN
    (SELECT pcchildcode
    ||','
    || pcchild item
    FROM afpc
    CONNECT BY pcparent = prior pcchild
    AND pcparentcode = prior pcchildcode START
    WITH pcparent = 232
    AND pcparentcode = 'CAS'
    UNION ALL
    SELECT pcparentcode
    ||','
    || pcparent item
    FROM afpc
    CONNECT BY pcchild = prior pcparent
    AND pcchildcode = prior pcparentcode START
    WITH pcchild =4264
    AND pcchildcode = 'ACT'
    )

    Something to just try i guess (wild guessing here).
    WITH
       itemcodes AS
       SELECT
          DISTINCT ItemCode
       FROM
          SELECT 'ACT,' || 4264 AS ItemCode
          FROM DUAL
             UNION ALL    
             SELECT pcchildcode || ',' || pcchild item AS ItemCode
             FROM afpc
             CONNECT BY  pcparent       = prior pcchild
             AND         pcparentcode   = prior pcchildcode
             START WITH  pcparent       = 232
             AND         pcparentcode   = 'CAS'
                UNION ALL
             SELECT pcparentcode || ',' || pcparent item AS ItemCode
             FROM afpc
             CONNECT BY  pcchild     = prior pcparent
             AND         pcchildcode = prior pcparentcode
             START WITH  pcchild     = 4264
             AND         pcchildcode = 'ACT'
    SELECT
       v.ITEMTYPE,
       v.ITEMID,
       v.NOTESID,
       v.NOTES,
       v.DUEDATE,
       v.OPENDATE,
       v.SUBJECT,
       v.TYPE,
       v.STATUS,
       v.OWNER,
       v.CREATEBY,
       v.CREATEDATE,
       v.ITEMCODE
    FROM v_allitems v,  itemcodes i
    WHERE v.ItemCode  = i.ItemCode;Assuming (probably a good assumption) that's not good, how long does this query take to finish for you?
             SELECT pcchildcode || ',' || pcchild item AS ItemCode
             FROM afpc
             CONNECT BY  pcparent       = prior pcchild
             AND         pcparentcode   = prior pcchildcode
             START WITH  pcparent       = 232
             AND         pcparentcode   = 'CAS'
                UNION ALL
             SELECT pcparentcode || ',' || pcparent item AS ItemCode
             FROM afpc
             CONNECT BY  pcchild     = prior pcparent
             AND         pcchildcode = prior pcparentcode
             START WITH  pcchild     = 4264
             AND         pcchildcode = 'ACT'

  • Help with Flex - PHP - and SQL Server

    Good afternoon,
    I have been working on this problem for over a week and am at
    my wit's end. I am trying to create an application that will allow
    me and my fellow statisticians to share code easily. The
    technologies at my disposal are Flex, PHP and SQL Server 2005. The
    web server is IIS. I have downloaded and installed the PHP driver
    for SQL Server 2005 and am able to query the database and generate
    XML. The problem I'm having is that I can't return the XML from PHP
    to Flex.
    If I execute the php code in a web browser and view the
    source, it looks like XML. I can then cut and paste the exact same
    code into an xml file and read it in from the harddisk and the tree
    will populate. Can anyone please help me? I don't have flex builder
    so I it's hard for me to use trace and view what is going on.
    Thanks in advance,
    Eric Graves

    Thanks for the suggestion. I have tried every permutation of
    e4x path notation I can think of. You're right, you're not supposed
    to need the root level as that's supposed to be returned in the
    result. So you should only need to reference first level after the
    root. When I do this and launch the .SWF I get a completely empty
    tree.
    I think the problem lies somewhere in my understanding of
    what format Flex needs returned from a HTTPRequest. It's my
    understanding that it just needs to be XML. As far as I can tell,
    that's what I'm sending it. On the PHP side, does it have to be
    cast a special way? Everything I've seen just shows people using
    ECHO to output the XML data.

  • Help with a really simple SQL statement

    Hi All
    I'm relatively new to SQL and can't get my head round what I believe to be a really simple problem.
    I have a table I want to query called locations. We use locations to mean groups and regions as well as people s ofr example:
    TABLE: LOCATION
    IDENTIFIER----------NAME-----------------PART_OF
    101--------------------USER A---------------123
    123--------------------GROUP A-------------124
    etc
    What I'm trying to write is a statement that will return the 'PART_OF' as the 'NAME' rather than the ID number if the ID = 101.
    I was wondering if a nested select statement would do (select as select etc) but just can't get my head round it!
    Any ideas?
    TIA. Jake.

    Hi Jake,
    It's not clear what you are looking for. If USER A is just Part of GROUP A, a self-join will do:
    SQL> with loc as (select 101 locid, 'USER A' locname, 123 part_of from dual
                 union all
                 select 123 locid, 'GROUP A' locname, 124 part_of from dual
                 union all
                 select 124 locid, 'REGION A' locname, null part_of from dual)
    -- End of test data
    select l1.locid, l1.locname, l2.locname part_of
      from loc l1, loc l2
    where l2.locid(+) = l1.part_of
         LOCID LOCNAME  PART_OF
           101 USER A   GROUP A
           123 GROUP A  REGION A
           124 REGION A        
    3 rows selected.But if you want USER A to be part of REGION A, then you need a hierarchia lquery:
    SQL> with loc as (select 101 locid, 'USER A' locname, 123 part_of from dual
                 union all
                 select 123 locid, 'GROUP A' locname, 124 part_of from dual
                 union all
                 select 124 locid, 'REGION A' locname, null part_of from dual)
    -- End of test data
    select l1.locid, l1.locname, connect_by_root(locname) part_of
      from loc l1
    start with part_of is null
    connect by prior locid = part_of
         LOCID LOCNAME  PART_OF
           124 REGION A REGION A
           123 GROUP A  REGION A
           101 USER A   REGION A
    3 rows selected.Regards
    Peter

  • Help with AP_Invoice Tables in SQL

    Hi Gurus,
    I am working on a report where i created a view. This query pulls data from SO,PO,ITEMS,AP and AR tables. The problem I am having is when I add a AP tables or a field from that table some of the Order Numbers are disappearing. Could someone please shed some light this. Here is the query
    SELECT DISTINCT trxl.CUSTOMER_TRX_LINE_ID,
    pv.vendor_name,
    api.invoice_num AP_Invoice_Num,
    trx.trx_date AR_Invoice_Date,
    trx.trx_number AR_Invoice_Number,
    pll.quantity_received,
    pll.quantity_billed,
    ool.shipped_quantity,
    mtlb.segment1 NSN,
    poh.closed_date po_close_date,
    gl.gl_date
    FROM apps.oe_order_headers_all ooh,
    apps.oe_order_lines_all ool,
    apps.oe_drop_ship_sources odss,
    apps.po_headers_all poh,
    apps.po_lines_all pol,
    apps.po_line_locations_all pll,
    apps.po_vendors pv,
    inv.mtl_system_items_b mtlb,
    ar.Ra_customer_trx_all trx,
    ar.ra_customer_trx_lines_all trxl,
    ar.hz_parties hzp,
    ar.hz_cust_accounts hzc,
    ap.ap_invoices_all api,
    ap.ap_invoice_lines_all apl,
    apps.RA_CUST_TRX_LINE_GL_DIST_ALL gl
    WHERE odss.header_id = ooh.header_id
    AND odss.line_id = ool.line_id
    AND odss.po_header_id = poh.po_header_id
    AND odss.po_line_id = pol.po_line_id
    AND odss.line_location_id = pll.line_location_id
    AND pv.vendor_id = poh.vendor_id
    AND mtlb.inventory_item_id = ool.inventory_item_id
    AND trxl.customer_trx_id = trx.customer_trx_id
    AND trxl.inventory_item_id = mtlb.inventory_item_id
    AND hzc.cust_account_id = ooh.sold_to_org_id
    AND hzc.party_id = hzp.party_id
    AND apl.invoice_id = api.invoice_id
    AND apl.po_header_id = poh.po_header_id
    AND apl.inventory_item_id = mtlb.inventory_item_id
    AND api.vendor_id = poh.vendor_id
    AND ool.line_id = trxl.interface_line_attribute6
    AND to_char(ooh.order_number)= trx.interface_header_attribute1
    AND trxl.CUSTOMER_TRX_LINE_ID = gl.CUSTOMER_TRX_LINE_ID
    AND gl.gl_date IS NOT NULL
    ORDER BY trxl.CUSTOMER_TRX_LINE_ID DESC;
    Really appreciate your help
    Thank You,

    Hi ,
    Need to place outer join for AP Tables .
    Regards
    Muthu

  • Need help with ASA 5512 and SQL port between DMZ and inside

    Hello everyone,
    Inside is on gigabitEthernet0/1 ip 192.9.200.254
    I have a dmz on gigabitEthernet2 ip 192.168.100.254
    I need to pass port 443 from outside to dmz ip 192.168.100.80 and open port 1433 from 192.168.100.80 to the inside network. 
    I believe this will work for port 443:
    object network dmz
    subnet 192.168.100.0 255.255.255.0
    object network webserver
    host 192.168.100.80
    object network webserver
    nat (dmz,outside) static interface service tcp 443 443
    access-list Outside_access_in extended permit tcp any object webserver eq 443
    access-group Outside_access_in in interface Outside
    However...How would I open only port 1433 from dmz to inside?
    At the bottom of this message is my config if it helps.
    Thanks,
    John Clausen
    Config:
    : Saved
    ASA Version 9.1(2) 
    hostname ciscoasa-gcs
    domain-name router.local
    enable password f4yhsdf.4sadf977 encrypted
    passwd f4yhsdf.4sadf977 encrypted
    names
    ip local pool vpnpool 192.168.201.10-192.168.201.50
    interface GigabitEthernet0/0
     nameif outside
     security-level 0
     ip address 123.222.222.212 255.255.255.224 
    interface GigabitEthernet0/1
     nameif inside
     security-level 100
     ip address 192.9.200.254 255.255.255.0 
    interface GigabitEthernet0/2
     nameif dmz
     security-level 100
     ip address 192.168.100.254 255.255.255.0 
    interface GigabitEthernet0/3
     shutdown
     no nameif
     no security-level
     no ip address
    interface GigabitEthernet0/4
     shutdown
     no nameif
     no security-level
     no ip address
    interface GigabitEthernet0/5
     shutdown
     no nameif
     no security-level
     no ip address
    interface Management0/0
     management-only
     nameif management
     security-level 100
     ip address 192.168.1.1 255.255.255.0 
    ftp mode passive
    dns server-group DefaultDNS
     domain-name router.local
    object network inside-subnet
     subnet 192.9.200.0 255.255.255.0
    object network netmotion
     host 192.9.200.6
    object network inside-network
     subnet 192.9.200.0 255.255.255.0
    object network vpnpool
     subnet 192.168.201.0 255.255.255.192
    object network NETWORK_OBJ_192.168.201.0_26
     subnet 192.168.201.0 255.255.255.192
    object network NETWORK_OBJ_192.9.200.0_24
     subnet 192.9.200.0 255.255.255.0
    access-list outside_access_in extended permit icmp any4 any4 log disable 
    access-list Outside_access_in extended permit udp any object netmotion eq 5020 
    access-list split standard permit 192.9.200.0 255.255.255.0 
    access-list VPNT_splitTunnelAcl standard permit 192.9.200.0 255.255.255.0 
    pager lines 24
    logging asdm informational
    mtu outside 1500
    mtu inside 1500
    mtu management 1500
    mtu dmz 1500
    icmp unreachable rate-limit 1 burst-size 1
    no asdm history enable
    arp timeout 14400
    no arp permit-nonconnected
    nat (inside,outside) source static inside-network inside-network destination static vpnpool vpnpool
    nat (inside,outside) source static NETWORK_OBJ_192.9.200.0_24 NETWORK_OBJ_192.9.200.0_24 destination static NETWORK_OBJ_192.168.201.0_26 NETWORK_OBJ_192.168.201.0_26 no-proxy-arp route-lookup
    object network netmotion
     nat (inside,outside) static interface service udp 5020 5020 
    nat (inside,outside) after-auto source dynamic any interface
    access-group Outside_access_in in interface outside
    route outside 0.0.0.0 0.0.0.0 123.222.222.1 1
    timeout xlate 3:00:00
    timeout pat-xlate 0:00:30
    timeout conn 1:00:00 half-closed 0:10:00 udp 0:02:00 icmp 0:00:02
    timeout sunrpc 0:10:00 h323 0:05:00 h225 1:00:00 mgcp 0:05:00 mgcp-pat 0:05:00
    timeout sip 0:30:00 sip_media 0:02:00 sip-invite 0:03:00 sip-disconnect 0:02:00
    timeout sip-provisional-media 0:02:00 uauth 0:05:00 absolute
    timeout tcp-proxy-reassembly 0:01:00
    timeout floating-conn 0:00:00
    dynamic-access-policy-record DfltAccessPolicy
    user-identity default-domain LOCAL
    http server enable
    http 192.168.1.0 255.255.255.0 management
    http 192.9.200.0 255.255.255.0 inside
    no snmp-server location
    no snmp-server contact
    snmp-server enable traps snmp authentication linkup linkdown coldstart warmstart
    crypto ipsec ikev1 transform-set ESP-3DES-MD5 esp-3des esp-md5-hmac 
    crypto ipsec ikev1 transform-set ESP-DES-MD5 esp-des esp-md5-hmac 
    crypto ipsec ikev1 transform-set ESP-3DES-SHA esp-3des esp-sha-hmac 
    crypto ipsec ikev1 transform-set ESP-AES-128-SHA esp-aes esp-sha-hmac 
    crypto ipsec ikev1 transform-set ESP-AES-192-SHA esp-aes-192 esp-sha-hmac 
    crypto ipsec ikev1 transform-set ESP-AES-128-MD5 esp-aes esp-md5-hmac 
    crypto ipsec ikev1 transform-set ESP-AES-192-MD5 esp-aes-192 esp-md5-hmac 
    crypto ipsec ikev1 transform-set ESP-AES-256-SHA esp-aes-256 esp-sha-hmac 
    crypto ipsec ikev1 transform-set ESP-AES-256-MD5 esp-aes-256 esp-md5-hmac 
    crypto ipsec ikev1 transform-set ESP-DES-SHA esp-des esp-sha-hmac 
    crypto ipsec security-association pmtu-aging infinite
    crypto dynamic-map SYSTEM_DEFAULT_CRYPTO_MAP 65535 set pfs group5
    crypto dynamic-map SYSTEM_DEFAULT_CRYPTO_MAP 65535 set ikev1 transform-set ESP-AES-128-SHA ESP-AES-128-MD5 ESP-AES-192-SHA ESP-AES-192-MD5 ESP-AES-256-SHA ESP-AES-256-MD5 ESP-3DES-SHA ESP-3DES-MD5 ESP-DES-SHA ESP-DES-MD5
    crypto map outside_map 65535 ipsec-isakmp dynamic SYSTEM_DEFAULT_CRYPTO_MAP
    crypto map outside_map interface outside
    crypto ca trustpool policy
    crypto ikev1 enable outside
    crypto ikev1 policy 10
     authentication crack
     encryption aes-256
     hash sha
     group 2
     lifetime 86400
    crypto ikev1 policy 20
     authentication rsa-sig
     encryption aes-256
     hash sha
     group 2
     lifetime 86400
    crypto ikev1 policy 30
     authentication pre-share
     encryption aes-256
     hash sha
     group 2
     lifetime 86400
    crypto ikev1 policy 40
     authentication crack
     encryption aes-192
     hash sha
     group 2
     lifetime 86400
    crypto ikev1 policy 50
     authentication rsa-sig
     encryption aes-192
     hash sha
     group 2
     lifetime 86400
    crypto ikev1 policy 60
     authentication pre-share
     encryption aes-192
     hash sha
     group 2
     lifetime 86400
    crypto ikev1 policy 70
     authentication crack
     encryption aes
     hash sha
     group 2
     lifetime 86400
    crypto ikev1 policy 80
     authentication rsa-sig
     encryption aes
     hash sha
     group 2
     lifetime 86400
    crypto ikev1 policy 90
     authentication pre-share
     encryption aes
     hash sha
     group 2
     lifetime 86400
    crypto ikev1 policy 100
     authentication crack
     encryption 3des
     hash sha
     group 2
     lifetime 86400
    crypto ikev1 policy 110
     authentication rsa-sig
     encryption 3des
     hash sha
     group 2
     lifetime 86400
    crypto ikev1 policy 120
     authentication pre-share
     encryption 3des
     hash sha
     group 2
     lifetime 86400
    crypto ikev1 policy 130
     authentication crack
     encryption des
     hash sha
     group 2
     lifetime 86400
    crypto ikev1 policy 140
     authentication rsa-sig
     encryption des
     hash sha
     group 2
     lifetime 86400
    crypto ikev1 policy 150
     authentication pre-share
     encryption des
     hash sha
     group 2
     lifetime 86400
    telnet 192.9.200.0 255.255.255.0 inside
    telnet timeout 5
    ssh timeout 5
    ssh key-exchange group dh-group1-sha1
    console timeout 0
    dhcpd address 192.168.1.2-192.168.1.254 management
    dhcpd enable management
    threat-detection basic-threat
    threat-detection statistics access-list
    no threat-detection statistics tcp-intercept
    ssl encryption aes128-sha1 3des-sha1
    webvpn
     enable outside
     anyconnect image disk0:/anyconnect-win-2.5.2014-k9.pkg 2 regex "Windows NT"
     anyconnect image disk0:/anyconnect-macosx-i386-2.5.2014-k9.pkg 3 regex "Intel Mac OS X"
     anyconnect enable
     tunnel-group-list enable
    group-policy SSLVPN internal
    group-policy SSLVPN attributes
     dns-server value 192.9.200.13
     vpn-tunnel-protocol ssl-client 
     split-tunnel-policy tunnelspecified
     split-tunnel-network-list value split
     default-domain value router.local
    group-policy VPNT internal
    group-policy VPNT attributes
     dns-server value 192.9.200.13
     vpn-tunnel-protocol ikev1 l2tp-ipsec 
     split-tunnel-policy tunnelspecified
    split-tunnel-network-list value VPNT_splitTunnelAcl
     default-domain value router.local
    username grimesvpn password 7.wersfhyt encrypted
    username grimesvpn attributes
     service-type remote-access
    tunnel-group SSLVPN type remote-access
    tunnel-group SSLVPN general-attributes
     address-pool vpnpool
     default-group-policy SSLVPN
    tunnel-group SSLVPN webvpn-attributes
     group-alias SSLVPN enable
    tunnel-group VPNT type remote-access
    tunnel-group VPNT general-attributes
     address-pool vpnpool
     default-group-policy VPNT
    tunnel-group VPNT ipsec-attributes
     ikev1 pre-shared-key *****
    class-map inspection_default
     match default-inspection-traffic
    policy-map type inspect dns preset_dns_map
     parameters
      message-length maximum client auto
      message-length maximum 512
    policy-map global_policy
     class inspection_default
      inspect dns preset_dns_map 
      inspect ftp 
      inspect h323 h225 
      inspect h323 ras 
      inspect rsh 
      inspect rtsp 
      inspect esmtp 
      inspect sqlnet 
      inspect skinny  
      inspect sunrpc 
      inspect xdmcp 
      inspect sip  
      inspect netbios 
      inspect tftp 
      inspect ip-options 
      inspect icmp 
    service-policy global_policy global
    prompt hostname context 
    no call-home reporting anonymous
    Cryptochecksum:36271b5a1b9382621e14c3aa635e2fbb
    : end

    Hi Vibor. Apologies if my comment was misunderstood.  What I meant to say was that the security level of the dmz interface should probably be less than 100. 
    And therefore traffic could be controlled between DMZ and inside networks. 
    As per thr security level on the DMZ interface. ....... that command is correct. :-)

  • Help with Date function in sql query....

    My question I guess is really 2...I'm trying to use the date function as a comparison in my WHERE clause in my sql command.
    1. My date format is dd-MMM-yy eg. (01-Apr-06) ... my problem is the Apr is lower case where my field in the database is 01-APR-06 so when I compare 01-Apr-06 to 01-APR-06 is doesnt find any rows. Is there away that I can make the Apr all upper case so that it is APR.
    2. My second problem is getting this "date" field to work in my sql stmt I keep getting errors and it works fine if I take my attempts at trying to compare the date.
    --------------Date Code----------------------------------------------------------
    <%!
    String getFormattedDate(java.util.Date d)
    SimpleDateFormat simpleDate = new SimpleDateFormat("01-MMM-yy");
    return simpleDate.format(d);
    %>
    <%
    java.util.Date d = new java.util.Date();
    String dateString = getFormattedDate (d);
    %>
    ---------------------------Sql statment------------------------------------------
    ResultSet rset = stmt.executeQuery ("SELECT name " + " FROM table where rdate = '01-APR-06' order by name ");
    Currently Im just hard coding the date but I need to make it so it uses the date code...so....
    rdate should equal the date from the formatted date in upper case
    something like
    rdate = <%= dateString %>
    Thanks in advance for any ideas anyone may have...

    There are sql functions upper & lower.
    SELECT name  FROM table where upper(rdate) = '01-APR-06' order by name Or you could convert the date to a string, and use the toUpperCase & toLowerCase java.lang.String methods. It doesn't make much of a difference--do you want the java compiler to do the string conversion or the database?

Maybe you are looking for

  • Can't sync music on Ipod after formatting

    I recently formatted my computer and so, lost Itunes. I installed it all over again. No problem until then. I put my music and videos from my Ipod (Fifth generation, 30go) on my computer and then on my new Itunes. Doing this, I lost over 500 songs an

  • No authorization to change authorization data

    Hello, When trying to change an opportunity in our CRM system we get this error message only for one partner. "No authorization to change authorization data" Our user has SAP_ALL, SAP_NEW and we don't find anything in st01. Any idea for this issue? C

  • Griddata 'v4' interpolation

    I'm using an equation node so that I can use the griddata('v4') method for interpolating an (x,y,z) Data set.  For the most part, it seems like the interpolation is generating the right points.  But in some cases I'm running into some unexplained res

  • Help with executing windows command in java

    hi, i am trying to execute dos command in java. currently i am trying simply to create a folder in the current directory. here is the code snippet: try { Process p = Runtime.getRuntime().exec("md myFolder"); } catch (IOException io) { io.printStackTr

  • HP Photosmart 7520 --- poor photo printing

    Brand new printer.  $100 in toner (including Photo Black Cartridge) and using HP Photo Paper (included in Toner Cartridge package).  I have run diagnostic.  Cleaned printer heads and alignment check and this is what my pictures turn out like.   What