Select * from v$ PDB returning some lines of non - sys account DBA

I am unable to find any documentation related to this privilege can benefit a common user in CBD root of database that allows the user to select from V$ PDB

Server11:CPPPRD:Oracle: / u01/app > sqlplus C ##IMDBA - this user has a DBA role in the base of the root

SQL * more: Production of the version 12.1.0.2.0 on Mon Sep 14 08:26:17 2015

Copyright (c) 1982, 2014, Oracle. All rights reserved.

Enter the password:

Last successful login time: Fri Sep 11-2015 15:55:05-0600

Connected to:

Database Oracle 12 c Enterprise Edition Release 12.1.0.2.0 - 64 bit Production

With the partitioning, OLAP, Advanced Analytics, Real Application Testing

and Unified audit options

SQL > select * from v$ PDB;

no selected line

SQL > exit

Disconnected from the database Oracle 12 c Enterprise Edition Release 12.1.0.2.0 - 64 bit Production

With the partitioning, OLAP, Advanced Analytics, Real Application Testing

and Unified audit options

Server11:CPPPRD:Oracle: / u01/app > sqlplus / as sysdba

SQL * more: Production of the version 12.1.0.2.0 on Mon Sep 14 08:26:36 2015

Copyright (c) 1982, 2014, Oracle. All rights reserved.

Connected to:

Database Oracle 12 c Enterprise Edition Release 12.1.0.2.0 - 64 bit Production

With the partitioning, OLAP, Advanced Analytics, Real Application Testing

and Unified audit options

SQL > select name from v$ PDB;

NAME

------------------------------

PDB$ SEEDS

APPPROD

SQL > exit

Disconnected from the database Oracle 12 c Enterprise Edition Release 12.1.0.2.0 - 64 bit Production

With the partitioning, OLAP, Advanced Analytics, Real Application Testing

and Unified audit options

If you want that the common user will be able to view this data across all containers, you will need to use the container_data clause.

Run through the user SYS to the CBD$ ROOT the following command:

change user C ##IMDBA set container_data = container all = current

BTW, you can also specify that C ##IMDBA will have the ability to view the data across all the container only for V$ PDB by running:

change user ##IMDBA set container_data = all Molok sys.v_ C $pdbs = current

And you can also check the settings of data container by selecting CDB_CONTAINER_DATA

According to the Oracle doc:

container_data_clause

The container_data_clause allows the game and change CONTAINER_DATA to a common user attributes. Use of the FOR clause to indicate whether to set or change the default CONTAINER_DATA attribute or a specific object CONTAINER_DATA attribute. These attributes determine all of the containers (which can never exclude the root) whose data will be visible via CONTAINER_DATA objects to the common user specified when the current session is the root.

Read more here:

http://docs.Oracle.com/database/121/Admin/cdb_mon.htm#ADMIN13931

http://docs.Oracle.com/database/121/SQLRF/statements_4003.htm#SQLRF01103

Tags: Database

Similar Questions

  • SQLite Select * from table1 - cannot see last line

    Hello

    I did some testing with SQLite component on the Simulator and ran into a problem. When I try to retrieve the data from the database (storage works great... open the db to an observer and data file has been stored properly), I can't get the last line of the query. I have something in the sense of the following:

    try {
          Statement _statement = m_db.createStatement("SELECT * FROM TABLE1");
          _statement.prepare();
          _statement.execute();
          Cursor _cursor = _statement.getCursor();
          if (_cursor != null) {
    
            while (_cursor.next()){
                Row _row = (Row)_cursor.getRow();
                // Read row. For example:
                int idx1 = _row.getColumnIndex("id");
                int idx2 = _row.getColumnIndex("name");
    
                String _id           = _row.getString(idx1);
                String _name         = _row.getString(idx2);
            }
          }
          _statement.close();
          _cursor.close();
        } catch (Throwable e) {
          Dialog.alert("unable to get row data");
        }
    

    The first problem is that _cursor.next does not succeed, and the loop is not executed. If I change the code to force it to enter the loop (ie. cursor.first and run the .getPixel etc... in any case), I always get the LAST row, even when I use the position (1, 2, 3, 4... etc) function. It's pretty boring. I develop this 5.0 and testing with 9700 Simulator. Any ideas why I would see only the last row?

    Why the next file in the thropugh code above, I can't retrieve a row in the database?

    Note I tried dogin cursor.first ()... . Run the .GetPixel and the. next(), don't always gets me the line after line and the other always returns false. I do a select empty in the database, all lines should be there (checked the structure of data in another program... it is fine), no idea why it isn't here?

    Thanks in advance.

    Figured this out, the _statement.execute (); should not be there.

  • Select * from tbl1 less select * from tbl2 is null

    Hi all
    I have 2 tables with the same 8 column, a column has the value zero from top to bottom.
    60 000 lines, tbl1 tbl2 has 70 000 lines.
    I need to see the 10,000 lines of tbl2 that are distinguished by the lines of tbl1.
    If I run select * from tbl1 intersect select * from tbl2, I get all the 60,000 tbl1 lines.

    However, if I run select * from tbl2 less select * from tbl1 I get no line?

    I can't understand why, can anyone help, please.

    Thank you
    Kowalsky

    Are you sure that it's really 10,000 TBL2 lines which are distinguished by a line any in TBL1? Instead of 10,000 additional rows in double?

    Justin

  • What privileges granted to select from all the PDB files

    Why the two selected does not return the same result? Or if you want the broader question - what privileges granted to select from all the PDB files.


    I want to leave common user that I created to select and see all of the synonyms of all PDB files.


    conn / as sysdba

    create user c##nir identified by c##nir container=all;

    grant connect,dba,resource to c##nir container=all;
    grant select on cdb_synonyms to c##nir container=all;

    select CON_ID  from cdb_synonyms  group by CON_ID;

      CON_ID
    ----------
      
    1
      
    4
      
    11
      
    10
      
    14
      
    5
      
    8
      
    13
      
    3
      
    7
      
    15
      
    6
      
    12
      
    9

    conn c
    ##nir/c##nir

    select CON_ID  from cdb_synonyms  group by CON_ID;

      CON_ID
    ----------
      
    1

    select CON_ID  from containers(dba_synonyms)  group by CON_ID
      
    *
    ERROR at line
    1:
    ORA-00942
    : table or view does not exist

    You must use the CONTAINER_DATA clause:

    ALTER USER ##nir set container_data = container c all = current;

    After running the above command, try to select again to cdb_synonyms and you will see the data of all containers.

    Read more in my Post of Blog

  • Select from another table, when the query returns no result

    Hello

    I have a question where I'm supposed to retrieve the address of an account id-based billing. However, the table of billing may not have an address. There is a table of addresses that always has an address for an account. If the billing address exists, it should be used, so I can't use the address table. Is it possible in a select statement to query to the billing address and if it does not exist, use the address table.

    SELECT * FROM accounts a, b billings WHERE a.accountid = b.accountid

    Any help will be greatly appreciated.

    Thank you.

    user10407139 wrote:
    Hello

    I have a question where I'm supposed to retrieve the address of an account id-based billing. However, the table of billing may not have an address. There is a table of addresses that always has an address for an account. If the billing address exists, it should be used, so I can't use the address table. Is it possible in a select statement to query to the billing address and if it does not exist, use the address table.

    SELECT * FROM accounts a, b billings WHERE a.accountid = b.accountid

    Any help will be greatly appreciated.

    I think you need to explain more clearly if

    -you only have a couple of "billing" columns which is empty and in this case, you want to use the columns from the table 'accounts '.

    - or you have a join with another table that doesn't return data, for example a foreign key "address_id" "billing" is zero and therefore the join to other tables 'address' will return all the data

    In the first case, you have already been provided with some examples here, how to use NVL or similar functions to achieve, even if the first post first evaluates the information of 'accounts' and if it is white using information from "billing". According to your description you need the other way around. The second post a subquery recursive useless in my opinion.

    In the latter case, you should probably use an "outer" join so that the data in your table "bills" are returned, even if the join to another table is not at all the lines.

    SELECT
    NVL(AD1.ADDRESS_ATTR1, AD2.ADDRESS_ATTR1) as ADDRESS_ATTR1,
    NVL(AD1.ADDRESS_ATTR2, AD2.ADDRESS_ATTR2) as ADDRESS_ATTR2,
    NVL(AD1.ADDRESS_STREET, AD2.ADDRESS_STREET) as ADDRESS_STREET,
    ...
    FROM accounts a
    INNER JOIN billings b
    ON a.accountid = b.accountid
    LEFT OUTER JOIN address ad1
    ON b.address_id = ad1.address_id
    INNER JOIN address ad2
    ON a.address_id = ad2.address_id;
    

    In this way you pick up the address stored in the "invoices" table, if it existed, otherwise you pick up the address assigned to the "accounts" table I used an inner for the second address join join because you said that the account always has an assigned address.

    Kind regards
    Randolf

    Oracle related blog stuff:
    http://Oracle-Randolf.blogspot.com/

    SQLTools ++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676 /.
    http://sourceforge.NET/projects/SQLT-pp/

  • Not the rows returned by the spatial query wrapped in SELECT * FROM...

    Hello

    When you run a query with SDO_EQUAL sub, I get a very strange behavior. The SDO_EQUAL query on its own works very well, but if I wrap in SELECT * from there, I get no results. If I wrap SDO_ANYINTERACT in SELECT * from there, I get the expected result.

    It seems like the spatial index is used during the execution of the ordinary, but not when SDO_EQUAL request wrapped in SELECT * FROM. Weird. The spatial index is also not used when SDO_ANYINTERACT is wrapped in SELECT * FROM... so I don't know why that returns the correct answer.

    I get this problem on 11.2.0.2 on Red Hat Linux 64-bit and 11.2.0.1 on Windows XP 32-bit (i.e., all versions of 11g I've tried). The query works as expected on 10.2.0.5 on Windows Server 2003 64-bit.

    Any ideas?

    Confused in Dublin (John)

    Test case...
    SQL> 
    SQL> -- Create a table and insert the same geometry twice
    SQL> DROP TABLE sdo_equal_query_test;
    
    Table dropped.
    
    SQL> CREATE TABLE sdo_equal_query_test (
      2  id NUMBER,
      3  geometry SDO_GEOMETRY);
    
    Table created.
    
    SQL> 
    SQL> INSERT INTO sdo_equal_query_test VALUES (1,
      2  SDO_GEOMETRY(3003, 81989, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1),
      3  SDO_ORDINATE_ARRAY(1057.39, 1048.23, 4, 1057.53, 1046.04, 4, 1057.67, 1043.94, 4, 1061.17, 1044.60, 5, 1060.95, 1046.49, 5, 1060.81, 1047.78, 5, 1057.39, 1048.23, 4)));
    
    1 row created.
    
    SQL> 
    SQL> INSERT INTO sdo_equal_query_test VALUES (2,
      2  SDO_GEOMETRY(3003, 81989, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1),
      3  SDO_ORDINATE_ARRAY(1057.39, 1048.23, 4, 1057.53, 1046.04, 4, 1057.67, 1043.94, 4, 1061.17, 1044.60, 5, 1060.95, 1046.49, 5, 1060.81, 1047.78, 5, 1057.39, 1048.23, 4)));
    
    1 row created.
    
    SQL> 
    SQL> -- Setup metadata
    SQL> DELETE FROM user_sdo_geom_metadata WHERE table_name = 'SDO_EQUAL_QUERY_TEST';
    
    1 row deleted.
    
    SQL> INSERT INTO user_sdo_geom_metadata VALUES ('SDO_EQUAL_QUERY_TEST','GEOMETRY',
      2  SDO_DIM_ARRAY(SDO_DIM_ELEMENT('X', 0, 100000, .0001), SDO_DIM_ELEMENT('Y', 0, 100000, .0001), SDO_DIM_ELEMENT('Z', -100, 4000, .0001))
      3  ,81989);
    
    1 row created.
    
    SQL> 
    SQL> -- Create spatial index
    SQL> DROP INDEX sdo_equal_query_test_spind;
    DROP INDEX sdo_equal_query_test_spind
               *
    ERROR at line 1:
    ORA-01418: specified index does not exist
    
    
    SQL> CREATE INDEX sdo_equal_query_test_spind ON sdo_equal_query_test(geometry) INDEXTYPE IS MDSYS.SPATIAL_INDEX;
    
    Index created.
    
    SQL> 
    SQL> -- Ensure data is valid
    SQL> SELECT sdo_geom.validate_geometry_with_context(sdo_cs.make_2d(geometry), 0.0001) is_valid
      2  FROM sdo_equal_query_test;
    
    IS_VALID
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    TRUE
    TRUE
    
    2 rows selected.
    
    SQL> 
    SQL> -- Check query results using sdo_equal
    SQL> SELECT b.id
      2  FROM sdo_equal_query_test a, sdo_equal_query_test b
      3  WHERE a.id = 1
      4  AND b.id != a.id
      5  AND sdo_equal(a.geometry, b.geometry) = 'TRUE';
    
            ID
    ----------
             2
    
    1 row selected.
    
    SQL> 
    SQL> -- Check query results using sdo_equal wrapped in SELECT * FROM
    SQL> -- Results should be the same as above, but... no rows selected
    SQL> SELECT * FROM (
      2       SELECT b.id
      3       FROM sdo_equal_query_test a, sdo_equal_query_test b
      4       WHERE a.id = 1
      5       AND b.id != a.id
      6       AND sdo_equal(a.geometry, b.geometry) = 'TRUE'
      7  );
    
    no rows selected
    
    SQL> 
    SQL> -- So that didn't work.  Now try sdo_anyinteract... this works ok
    SQL> SELECT * FROM (
      2       SELECT b.id
      3       FROM sdo_equal_query_test a, sdo_equal_query_test b
      4       WHERE a.id = 1
      5       AND b.id != a.id
      6       AND sdo_anyinteract(a.geometry, b.geometry) = 'TRUE'
      7  );
    
            ID
    ----------
             2
    
    1 row selected.
    
    SQL> 
    SQL> -- Now try a scalar query
    SQL> SELECT * FROM (
      2       SELECT b.id
      3       FROM sdo_equal_query_test a, sdo_equal_query_test b
      4       WHERE a.id = 1
      5       AND b.id != a.id
      6  );
    
            ID
    ----------
             2
    
    1 row selected.
    
    SQL> spool off
    Here is the plan of the explain output for the query that works. Note that the spatial index is used.
    SQL> EXPLAIN PLAN FOR
      2  SELECT b.id
      3  FROM sdo_equal_query_test a, sdo_equal_query_test b
      4  WHERE a.id = 1
      5  AND b.id != a.id
      6  AND sdo_equal(a.geometry, b.geometry) = 'TRUE';
    
    Explained.
    
    SQL> @?/rdbms/admin/utlxpls.sql
    
    PLAN_TABLE_OUTPUT
    ------------------------------------------------------------------------------------------------------------
    Plan hash value: 3529470109
    
    ------------------------------------------------------------------------------------------------------------
    | Id  | Operation                     | Name                       | Rows  | Bytes | Cost (%CPU)| Time     |
    ------------------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT              |                            |     1 |  7684 |     3   (0)| 00:00:01 |
    |   1 |  RESULT CACHE                 | f5p63r46pbzty4sr45td1uv5g8 |       |       |            |       |
    |   2 |   NESTED LOOPS                |                            |     1 |  7684 |     3   (0)| 00:00:01 |
    |*  3 |    TABLE ACCESS FULL          | SDO_EQUAL_QUERY_TEST       |     1 |  3836 |     3   (0)| 00:00:01 |
    |*  4 |    TABLE ACCESS BY INDEX ROWID| SDO_EQUAL_QUERY_TEST       |     1 |  3848 |     3   (0)| 00:00:01 |
    |*  5 |     DOMAIN INDEX              | SDO_EQUAL_QUERY_TEST_SPIND |       |       |     0   (0)| 00:00:01 |
    ------------------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       3 - filter("B"."ID"!=1)
       4 - filter("A"."ID"=1 AND "B"."ID"!="A"."ID")
       5 - access("MDSYS"."SDO_EQUAL"("A"."GEOMETRY","B"."GEOMETRY")='TRUE')
    ..... other stuff .....     
    Here is the plan of the explain output for the query is not working. Note that the spatial index is not used.
    SQL> EXPLAIN PLAN FOR
      2  SELECT * FROM (
      3     SELECT b.id
      4     FROM sdo_equal_query_test a, sdo_equal_query_test b
      5     WHERE a.id = 1
      6     AND b.id != a.id
      7     AND sdo_equal(a.geometry, b.geometry) = 'TRUE'
      8  );
    
    Explained.
    
    SQL> @?/rdbms/admin/utlxpls.sql
    
    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------------------------------
    Plan hash value: 1024466006
    
    --------------------------------------------------------------------------------------------------
    | Id  | Operation           | Name                       | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT    |                            |     1 |  7684 |     6   (0)| 00:00:01 |
    |   1 |  RESULT CACHE       | 2sd35wrcw3jr411bcg3sz161f6 |       |       |            |          |
    |   2 |   NESTED LOOPS      |                            |     1 |  7684 |     6   (0)| 00:00:01 |
    |*  3 |    TABLE ACCESS FULL| SDO_EQUAL_QUERY_TEST       |     1 |  3836 |     3   (0)| 00:00:01 |
    |*  4 |    TABLE ACCESS FULL| SDO_EQUAL_QUERY_TEST       |     1 |  3848 |     3   (0)| 00:00:01 |
    --------------------------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       3 - filter("B"."ID"!=1)
       4 - filter("A"."ID"=1 AND "B"."ID"!="A"."ID" AND
                  "MDSYS"."SDO_EQUAL"("A"."GEOMETRY","B"."GEOMETRY")='TRUE')
    ..... other stuff .....               

    Yes, this is the bug 9740355. You can get a 11.2.0.1 patch, or wait for 11.2.0.3.

  • Select from 2 dimensions collection returned by a pipeline-table-function

    With the help of 10 gr 2

    A pipeline function returns a collection of an object oriented sub-collection:


    TYPE TXT_ARRAYTYPE IS TABLE OF THE VARCHAR2 (2000);

    type txt2dtable_objtype as object)
    txt2dtable txt_arraytype;

    type txt2dtable_arraytype as the txt2dtable_objtype table;


    FUNCTION getTxtList (start_date IN DATE) RETURN PIPELINED txt2dtable_arraytype
    ....



    How can I select from the function for each element varchar2 grouped by line number (the top-level collection) txt2dtable_arraytype?

    Example:

    Text of RowNum
    1 Hello
    1 World
    2 my
    2 name
    2 is
    2 Nuerni!
    3 How
    ....


    A select statement can be used for an external, OIC - / JDBC / follow App would be great!

    Any ideas?

    Kind regards
    Nuerni

    Something like this:

    SQL>create type txt_arraytype is table of varchar2(2000)
      2  /
    
    Type created.
    
    SQL>create type txt2dtable_objtype as object ( txt2dtable txt_arraytype )
      2  /
    
    Type created.
    
    SQL>create type txt2dtable_arraytype as table of txt2dtable_objtype
      2  /
    
    Type created.
    
    SQL>create or replace FUNCTION getTxtList (start_date in date)
      2  return txt2dtable_arraytype pipelined
      3  is
      4  begin
      5    pipe row( txt2dtable_objtype( TXT_ARRAYTYPE( 'Hello', 'World' ) ) );
      6    pipe row( txt2dtable_objtype( TXT_ARRAYTYPE( 'My', 'name', 'is', 'Anton' ) ) );
      7    pipe row( txt2dtable_objtype( TXT_ARRAYTYPE( 'And', 'this', 'is', 'an', 'example' ) ) );
      8    return;
      9  end;
     10  /
    
    Function created.
    
    SQL>
    SQL>select rn, y.column_value
      2  from ( select rownum rn
      3              , object_value
      4         from table( getTxtList( sysdate ) )
      5       ) x
      6     , table( x.object_value.txt2dtable ) y
      7  /
    
            RN COLUMN_VALUE
    ---------- -----------------------------------------------------------------------------------------
             1 Hello
             1 World
             2 My
             2 name
             2 is
             2 Anton
             3 And
             3 this
             3 is
             3 an
             3 example
    
    11 rows selected.
    
    SQL>
    

    Anton

  • XML not nested queries return no line plus


    Hello
    I have an urgent problem concerning the following:
    I've migrated the XMLDB queries below 11.2.0.1 to 11.2.0.3

    I registered just the schema

    () DBMS_XMLSCHEMA.registerSchema
    SCHEMAURL = > ' http://www.mywebsite.com/XML/Impex/order/2006-10-31 ',
    SCHEMADOC = > bfilename ('XMLDIR', 'order.xsd'),
    local = > TRUE,
    gentypes = > TRUE,
    gentables = > TRUE,
    CSID = > nls_charset_id ('AL32UTF8'));
    COMMIT;

    Some query works correctly and others not more are:
    Queries that do not work are those referring to XML elements nested as in "QUERY 2" below

    I think I missed a few steps of initialization for XMLDB.

    Order.xsd is the same in both cases

    SQLTypes and collections air well (they were created.
    (Do not know gentables = > TRUE is necessary in creating schema)

    Please give some feedback soon.
    Thank you very much in advance.

    In the following XML_FILE is XMLTYPE


    QUERY 1
    SELECT THIS WORKS PROPERLY

    --------------------------------
    SELECT
    ORDER_LEVEL1.order_no,
    TO_TIMESTAMP (ORDER_LEVEL1.order_date, ' YYYY-MM-DD "T" HH24:MI:SS.ff3 "Z" "").
    ORDER_LEVEL1.created_by, ORDER_LEVEL1.currency, ORDER_LEVEL1.customer_locale, ORDER_LEVEL1.order_status
    Of
    p (selection double XML_FILE),
    XMLTable)
    xmlnamespaces (default 'http://www.mywebsite.com/xml/impex/order/2006-10-31'),
    ' / orders/order "ADOPTION p.XML_FILE
    COLUMNS
    The "@order-no"order_no WAY,
    ORDER_DATE PATH "order date"
    created_by PATH "created by",
    currency of access road "currency."
    customer_locale "client-local," PATH
    order_status PATH "order status/tracking".
    ) ORDER_LEVEL1;
    -----------------------------------


    QUERY 2
    THIS SELECTION IS NOT WORKING NOW (returns the LINES No.)
    --------------------------------
    Select
    order_no as order_no, STOREID as STOREID, SHIPPINGMETHOD as SHIPPINGMETHOD
    Of
    (
    with mainq as
    (
    Select
    ORDER_LEVEL1.order_no as ORDER_NO,
    CUSTOMATT_LEVEL2.*
    Of
    p (selection double XML_FILE),

    XMLTable)
    xmlnamespaces (default 'http://www.mywebsite.com/xml/impex/order/2006-10-31'),
    ' / orders/order "ADOPTION p.XML_FILE
    COLUMNS
    The "@order-no"order_no WAY,
    custom_attribute PATH of XMLTYPE "custom-attributes/custom-attribute.
    ) ORDER_LEVEL1,.

    XMLTable (xmlnamespaces (default 'http://www.mywebsite.com/xml/impex/order/2006-10-31'), )
    "/ custom attribute" ADOPTION ORDER_LEVEL1.custom_attribute
    COLUMNS
    attribute_id PATH ' @attribute-id ',
    path value 'value '.
    ) CUSTOMATT_LEVEL2
    )
    Select
    order_no,
    STOREID, Max (decode(attribute_id,'storeId',TheValue)),
    Max (decode(attribute_id,'shippingMethod',TheValue)) SHIPPINGMETHOD
    of mainq
    Order_no group
    );

    ORDER FOR REFERENCE. XSD (only the rΘation segment to the elements in the query)

    < xsd: element name = "orders" xdb:defaultTable = "ORDERS" >
    < xsd: complexType mixed = "false" xdb:SQLType = "DMW_ORDERS" xdb:maintainDOM = "false" >
    < xsd: SEQUENCE >
    < xsd: element name = "command" type = "complexType.Order" xdb:SQLCollType = "DMW_ORDERS_COLL" minOccurs = "0" maxOccurs = "unbounded" > < / xsd: element > "
    < / xsd: SEQUENCE >
    < / xsd: complexType >
    < / xsd: element >

    < xsd: complexType name = "complexType.Order" xdb:SQLType = "DMW_ORDER" xdb:maintainDOM = "false" > "
    < xsd: SEQUENCE >
    < xsd: element name = "order date" type = "xsd: DateTime" minOccurs = "1" maxOccurs = "1" xdb:SQLType = "TIMESTAMP WITH TIME ZONE" >
    < xsd: annotation >
    < xsd: documentation > original date and time, the order was placed. < / xsd: documentation >
    < / xsd: annotation >
    < / xsd: element >
    < xsd: element name = "created by" type = "simpleType.Generic.String.256" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
    < xsd: element name = "original-order-no" type = "simpleType.Generic.String.256" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
    < xsd: element name = "currency" type = "simpleType.Currency" maxOccurs = "1" minOccurs = "1" > < / xsd: element > "
    < xsd: element name = "customer-local" type = "simpleType.Generic.String.256" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
    < xsd: element name = "source code" type = "complexType.SourceCode" maxOccurs = "1" minOccurs = '0' > < / xsd: element > "
    < xsd: element name = "name-partner-affiliation" type = "simpleType.Generic.String.256" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
    < xsd: element name = "partner-affiliate-id" type = "simpleType.Generic.String.256" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
    < xsd: element name = "invoice-no" type = "simpleType.Generic.String.256" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
    < xsd: element name = "customer" type = "complexType.Customer" maxOccurs = "1" minOccurs = "0" > "
    < xsd: annotation >
    < xsd: documentation > information about the customer who placed the order. < / xsd: documentation >
    < / xsd: annotation >
    < / xsd: element >
    < xsd: element name = "customer-order-reference" type = "simpleType.Generic.String.256" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
    < xsd: element name = "status" type = "complexType.OrderStatusSet" maxOccurs = "1" minOccurs = "0" > "
    < xsd: annotation >
    < xsd: documentation > Order status information. < / xsd: documentation >
    < / xsd: annotation >
    < / xsd: element >
    < xsd: element name = "replace-code" type = "simpleType.Generic.String.256" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
    < xsd: element name = "description to replace" type = "simpleType.Generic.String.4000" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
    < xsd: element name = "replacement-order-no" type = "simpleType.Generic.String.256" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
    < xsd: element name = "replaced-order-no" type = "simpleType.Generic.String.256" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
    < xsd: element name = "current-order-no" type = "simpleType.Generic.String.256" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
    < xsd: element name = "cancel-code" type = "simpleType.Generic.String.256" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
    < xsd: element name = "cancel-description" type = "simpleType.Generic.String.4000" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
    < xsd: element name = "LineItem-product" type = "complexType.ProductLineItems" maxOccurs = "1" minOccurs = "0" > "
    < xsd: annotation >
    < xsd: documentation > product line items of the order. < / xsd: documentation >
    < / xsd: annotation >
    < / xsd: element >
    < xsd: element name = "LineItem-giftcertificate" type = "complexType.GiftCertificateLineItems" maxOccurs = "1" minOccurs = '0' > < / xsd: element > "
    < xsd: element name = "transport-LineItem" type = "complexType.ShippingLineItems" maxOccurs = "1" minOccurs = '0' > < / xsd: element > "
    < xsd: element name = "expeditions" type = "complexType.Shipments" maxOccurs = "1" minOccurs = "0" > "
    < xsd: annotation >
    < xsd: documentation > shipments of the command. < / xsd: documentation >
    < / xsd: annotation >
    < / xsd: element >
    < xsd: element name = "totals" type = "complexType.OrderTotals" maxOccurs = "1" minOccurs = "0" > "
    < xsd: annotation >
    < xsd: documentation > order total. < / xsd: documentation >
    < / xsd: annotation >
    < / xsd: element >
    < xsd: element name = "payments" minOccurs = "0" maxOccurs = "1" type = "complexType.Payments" >
    < xsd: annotation >
    < xsd: documentation > payments used for the order. < / xsd: documentation >
    < / xsd: annotation >
    < / xsd: element >
    < xsd: element name = "remoteHost" type = "simpleType.Generic.String.40" minOccurs = "0" maxOccurs = "1" / > "
    < xsd: element name = "notes" type = "complexType.Notes" minOccurs = "0" maxOccurs = "1" / > "
    < xsd: element name = "external-order-no" type = "simpleType.Generic.String.256" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
    < xsd: element name = "external-order tracking" type = "simpleType.Generic.String.256" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
    < xsd: element name = "external-order-text" type = "simpleType.Generic.String" minOccurs = "0" maxOccurs = "1" > < / xsd: element > "
    < xsd: element name = "custom attributes" type = "sharedType.CustomAttributes" minOccurs = "0" maxOccurs = "1" / > "
    < / xsd: SEQUENCE >
    < xsd: attribute name = "order-no" type = "simpleType.Generic.String.256" use = "required" / > "
    < / xsd: complexType >

    .......................

    < xsd: complexType name = "sharedType.CustomAttributes" mixed = "false" xdb:SQLType = "DMW_CUSTOMATTRIBUTES" xdb:maintainDOM = "false" > "
    < xsd: SEQUENCE >
    < xsd: element name = "custom, the attribute" type = "sharedType.CustomAttribute" minOccurs = "0" xdb:SQLCollType = "DMW_CUSTOMATTRIBUTES_COLL" maxOccurs = "unbounded" / > "
    < / xsd: SEQUENCE >
    < / xsd: complexType >

    .......................

    < xsd: complexType name = "sharedType.CustomAttribute" mixed = "true" xdb:SQLType = "DMW_CUSTOMATTRIBUTE" xdb:maintainDOM = "false" > "
    < xsd: SEQUENCE >
    < xsd: element name = "value" type = "simpleType.Generic.String" minOccurs = "0" maxOccurs = "unbounded" / > "
    < / xsd: SEQUENCE >
    < xsd: attribute name = "id attribute" type = "simpleType.Generic.NonEmptyString.256" use = "required" / > "
    < xsd: attribute ref = "XML: lang" / >
    < / xsd: complexType >

    -XML (partial segment) example
    <? XML version = "1.0" encoding = "UTF-8"? "> < ordered xmlns ="http://www.mywebsite.com/xml/impex/order/2006-10-31">."
    < order order-no = "BLY0000001605" >
    < - > 2014 order date - 02-25T 11: 00:30.959Z < / date of order >
    ECOMMERCE < created-by > < / created by >
    BLY0000001605 < original-order - No. > < / original-order-not >
    < currency > $ < / currency >
    <>client-local en_US < / customer-local >
    < status >
    Placed > order tracking < < / order >
    < / status >
    < custom attributes - >
    < attribute custom attribute id = "storeId" > < value > < / value > < / custom attribute >
    < attribute custom attribute id = "shippingMethod" > < value > SAMEDAY_DLV < / value > < / custom attribute >
    < / custom attributes >
    < / order >
    < / order >

    I can't believe it. You are right.

    Removed the external selection and it worked! Mysteries of the Oracle :-)

    Thank you so much Odie

    (just a question: is 63 your favorite number or your birth year? you can answer me separately if you like...)

    GP_63

  • Irregular data loss - function from PL/SQL returning data using Ref Cursor

    Database Version: 10.2.0.4.0 (node 2 CARS)

    The high-level process flow is as below:
    (1) insert records in a few tables & commit the same
    (2) call the pl/sql function to extract files (on certain conditions with joins with other tables) of the tables which are filled in step 1.
    -> It uses the ORDER BY clause to queries inline & line number 5000 records return for each call.
    Sense - if inline query is supposed to return 1,00,000 records then 20 calls to the same function. This, because the application cannot contain records beyond number.
    (3) the data returned by the ref cursor is then processed by application (Tibco BW) to generate the flat file.

    We are facing the problem of data loss in the file and there is no fixed model. It happens once between 200-300 calls process.
    Resolution: When the problem occurs, triggering the process and in almost every time re-outbreak of the process provides required data.

    Guidance on what could be the reason?

    * Examples of Code for the function:
    CREATE OR REPLACE FUNCTION FUNC_GET_HRCH_TOTAL_DATA)
    outinstrid in NUMBERS
    outinstrkey in NUMBERS
    rownumberstart in NUMBERS
    rownumbereend in NUMBERS
    err_code OUT VARCHAR2,
    err_msg OUT VARCHAR2)
    RETURN PACK_TYPES. HRCH_TOTAL_CURSOR
    IS
    REF_HRCH_TOTAL_CURSOR PACK_TYPES. HRCH_TOTAL_CURSOR;
    BEGIN

    OPEN FOR REF_HRCH_TOTAL_CURSOR
    SELECT *.
    FROM (SELECT A.HIERARCHY_KEY, B.KEY, B.VAL_KEY, A.KEY_NEW, C.ITEMID, B.VAL_TAG, B.sort_order, ROWNUM ROWNUMBER
    OF AOD_HRCH_ITEM A, AOD_HRCH_ATTR B, AOD_HRCH_ITEMS C
    WHERE A.outputid = B.outputid
    AND A.outputid = C.outputid AND A.outputkey = B.outputkey
    AND A.outputkey = C.outputkey AND A.outputid = outinstrid
    AND A.outputkey = outinstrkey AND A.ITEM_SEQ = B.ITEM_SEQ
    AND A.ITEM_SEQ = C.ITEM_SEQ AND A.HIERARCHY_LEVEL_ORDER = B.SORT_ORDER
    ORDER BY A.HIERARCHY_LEVEL_ORDER DESC)
    WHERE ROWNUMBER < rownumbereend
    AND ROWNUMBER > = rownumberstart;


    RETURN REF_HRCH_TOTAL_CURSOR;
    EXCEPTION
    WHILE OTHERS
    THEN
    err_code: = x_progress | ' - ' || SQLCODE;
    err_msg: = SUBSTR (SQLERRM, 1, 500);

    END FUNC_GET_HRCH_TOTAL_DATA;
    /

    Published by: meet_sanc on February 16, 2013 10:42

    Your SELECT statement is almost certainly incorrect

    SELECT *
      FROM ( SELECT A.HIERARCHY_KEY, B.KEY, B.VAL_KEY, A.KEY_NEW, C.ITEMID, B.VAL_TAG, B.sort_order,ROWNUM ROWNUMBER
               FROM AOD_HRCH_ITEM A, AOD_HRCH_ATTR B, AOD_HRCH_ITEMS C
              WHERE A.outputid = B.outputid
                AND A.outputid = C.outputid AND A.outputkey = B.outputkey
                AND A.outputkey = C.outputkey AND A.outputid = outinstrid
                AND A.outputkey = outinstrkey AND A.ITEM_SEQ = B.ITEM_SEQ
                AND A.ITEM_SEQ = C.ITEM_SEQ AND A.HIERARCHY_LEVEL_ORDER = B.SORT_ORDER
              ORDER BY A.HIERARCHY_LEVEL_ORDER DESC)
     WHERE ROWNUMBER < rownumbereend
       AND ROWNUMBER >= rownumberstart;
    

    Since the ORDER BY is applied after the ROWNUM is assigned in this case, your query is requested for a period of 5000 lines any arbitrariness. It would be perfectly valid for a single line to return in each of your 200 different calls or for a line to return in any of them.

    You definitely want to do something in the sense of the canonical askTom wire

    select *
      from ( select a.*, rownum rnum
               from ( YOUR_QUERY_GOES_HERE -- including the order by ) a
              where rownum <= MAX_ROWS )
     where rnum >= MIN_ROWS
    

    That said, it seems inconceivable that Tibco is unable to manage a cursor that returns more than a certain number of lines. You do a ton of work to return the data pages that are certainly not necessary. Unless you're saying that you somehow paralyzed your installation of Tibco giving him a ridiculously small amount of memory to process, something doesn't look good. A slider is just a pointer - it holds that no data - so the number of lines that you can extract a slider should have no impact on the amount of memory on the client application needs.

    As others have already pointed out, your exception handler is almost certainly do more harm than good. Return the error codes and error messages as from the OUT parameters, instead of simply allowing the exception to propagate deletes a ton of useful information (such as the mistake of the stack) and makes your process much less robust.

    Justin

  • produce a series of numbers to select from the shortcomings of the ID column

    (1)

    Suppose I have a table t that contains lines like this:

    A AND B
    ---------- ----------
    2 4
    6 7

    I would like to use select to produce lines with numbers between a column and column B included
    for each line, like this:

    Select from t...

    2
    3
    4
    6
    7

    (2)

    Suppose I have the ID column that is lacking, I want to get the lowest < N > numbers available between the gaps.
    I did some research and I can find the range of gaps, but I can't get the numbers listed separately, therefore
    I ask the question (1). But is there a direct way for the list instead of going through beaches and the list.

    For example, I have the ID column that has

    2
    5
    6
    7
    9
    2000000

    I would get a select query that produces

    Select...

    3
    4
    8
    10
    11

    I have a way to get a list of 2 to 2000000, then less than what we need to get all the
    numbers of the gap, but who is not effective and may is short-term memory.

    PS: before I post on this group, I did some research already on "connect by", with recursive queries.

    PuraVidaOTN wrote:

    I would like to use select to produce lines with numbers between a column and column B included

    for each line, like this:

    Assuming that no duplicates in the table...

    with t as
    (
     select 2 c1,4 c2 from dual union all
     select 6 c1,7 c2 from dual
    )
    select c1,c2,c1+level-1 c
    from t
    connect by c1+level-1 <= c2
    and prior c1 = c1
    and prior c2 = c2
    and prior sys_guid() is not null;
    
    C1 C2 C
    -- -- -
     2  4 2
     2  4 3
     2  4 4
     6  7 6
     6  7 7 
    

    Suppose I have the ID column that is lacking, I want to get the lowest numbers between the gaps.
    I did some research and I can find the range of gaps, but I can't get the numbers listed separately, therefore
    I ask the question (1). But is there a direct way for the list instead of going through beaches and the list.

    I have a way to get a list of 2 to 2000000, then less than what we need to get all the
    numbers of the gap, but who is not effective and may is short-term memory.

    It's the best way in my opinion...

    Or rather less, you can try outer join...

    Published by: JAC on December 19, 2012 21:28

  • 01427 00000 - "einreihig subquery returns several lines.

    Hi all
    How can I solve it
    SELECT 
           v.code
          ,v.bar_code
          ,v.arb_name
          ,v.eng_name
          ,v.branch_no
          ,(SELECT sum(quantity) FROM viw_whs_items_movement GROUP BY branch_no)
    FROM  viw_whs_items_movement V
    This code gives me this error
    01427 00000 - "einreihig subquery returns several lines.
    I know that I have more value, but I need this value

    Result group
    SELECT sum(v.quantity) 
    FROM viw_whs_items_movement v 
    GROUP BY v.branch_no
    ##########################
    SUM(V.QUANTITY)
    ---------------
             114453 
               2501 
               8137 
              13270 
              15230 
             120626 
              22536 
               2926 
              12848 
              37509 
              20911 
               7503 
               6248 
              17221 
                462 
                 24 
              15041 
              10307 
              12524 
             526627 
              10564 
               8230 
              13204 
               2840 
              80769 
            1418238 
             215694 
              15238 
               5063 
             104187 
                913 
             147079 
              11293 
              12678 
              18855 
    
     35 rows selected 

    Must be scalar subqueries. You demonstrate your subquery returns more than one line. Where the error.

    A solution would be to establish a correlation between the results of the subquery by joining the branch_id with branch_id of the outer query. However, as the two queries use the same table, you can simply use an analytical SUM():

    SELECT
           v.code
          ,v.bar_code
          ,v.arb_name
          ,v.eng_name
          ,v.branch_no
          ,sum(quantity) over (partition by branch_no) as branch_tot
    FROM  viw_whs_items_movement V      
    

    Cheers, APC

  • Problem with "select * from table" for dynamic IN the list

    I have a 'for loop' based a query that does not work. The query is supposed to return the name of the table, the data type and the name of the column in the columns poses a number of name filters. The problem I have is when I run the query into a TOAD with:

    schema_list value SCOTT, MED and the clause of 'in' as ' to (select * from table (DATAPUMP_UTIL.in_list_varchar2 (:schema_list))))»

    The query returns the expected lines.

    When I have it in my code as shown below it returns no rows. I don't know what hurts me, but any help would be great! I'm on Oracle 11.1.0.6.0.
    PROCEDURE export_schema_ondemand (schema_list VARCHAR2, encrypt_file NUMBER default 0, mask_sensitive_data NUMBER default 0) IS  
        ...
        schema_list_t := my_package.in_list_varchar2(schema_list);
        ... 
        for c1 in
           (
            with ok_to_mask as (
            select 
                owner,
                table_name, 
                column_name
            from   
               all_tab_columns
            where
                owner in (select * from table(schema_list_t))
            minus
            (SELECT 
                c.owner,
                p.table_name,
                cc.column_name
            FROM 
                all_cons_columns cc, 
                all_constraints p,
                all_constraints c
            WHERE 
                c.owner in (select * from table(schema_list_t))
                c.constraint_type = 'R'
                AND p.owner = c.r_owner
                AND p.constraint_name = c.r_constraint_name
                AND cc.owner = c.owner
                AND cc.constraint_name = c.constraint_name
                AND cc.table_name = c.table_name
            UNION ALL
            SELECT 
                c.owner,
                cc.table_name,
                cc.column_name
            FROM 
                all_cons_columns cc,
                all_constraints p,
                all_constraints c
            WHERE
                p.owner in (select * from table(schema_list_t))
                AND p.constraint_type in ('P','U')
                AND c.r_owner = p.owner
                AND c.r_constraint_name = p.constraint_name
                AND c.constraint_type = 'R'
                AND cc.owner = c.owner
                AND cc.constraint_name = c.constraint_name
                AND cc.table_name = c.table_name))
            select 
                atc.table_name as mask_tab, 
                atc.column_name as mask_col, 
                atc.data_type as mask_type
            from   
                all_tab_columns atc,
                ok_to_mask otm
            where
                atc.owner = otm.owner
                and atc.table_name = otm.table_name
                and atc.column_name = otm.column_name
                and atc.owner in (select * from table(schema_list_t))
                and 
                (
                atc.column_name like '%LAST%NAME%'
                or atc.column_name like '%FIRST%NAME%'
                or atc.column_name like '%NAME_LAST%'
                or  atc.column_name like '%NAME_FIRST%'
                or  atc.column_name like '%ENAME%'
                or atc.column_name like '%SSN%'
                or atc.column_name like '%DOB%'
                or atc.column_name like '%BIRTH%'
                )
                and atc.column_name not like '%PHYSICIAN_%'
                and atc.column_name not like '%DR_%'
                and atc.column_name not like '%PROVIDER_%'
                and atc.column_name not like 'PRESCRIBER_%'     
           )
          loop
             ...
    
    FUNCTION in_list_varchar2 (p_in_list  IN  VARCHAR2)  RETURN VARCHAR2_TT is
    
        l_tab   VARCHAR2_TT := VARCHAR2_TT();
        l_text  VARCHAR2(32767) := p_in_list || ',';
        l_idx   NUMBER;
            
    BEGIN
        LOOP l_idx := INSTR(l_text, ',');
            EXIT WHEN NVL(l_idx, 0) = 0;
            l_tab.extend;
            l_tab(l_tab.last) := TRIM(SUBSTR(l_text, 1, l_idx - 1));
            l_text := SUBSTR(l_text, l_idx + 1);
        END LOOP;
    
        RETURN l_tab;
            
    END in_list_varchar2;
    Published by: BluShadow on June 29, 2011 16:11
    addition of {noformat}
    {noformat} tags.  PLEASE READ {message:id=9360002} TO LEARN TO DO THIS YOURSELF.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

    Hello

    If you have a query that works well when you launch it directly, and that breaks down when you start with a procedure, this can be a problem of privileges.

    Points of view ALL_ * shows only the objects you have access, but using a procedure, privileges must be granted directly to the user and not with a role.

    You should check the SELECT privileges to your user through roles and give them directly to the user.

    Hope this will help.

    Sylvie

  • Having trouble selecting from a table function

    Need a function to return an array in the following format:
    WEEK_NBR               START_DATE END_DATE  
    ---------------------- ---------- --------- 
    0                      29-JAN-09  25-NOV-09 
    1                      26-NOV-09  02-DEC-09 
    2                      03-DEC-09  09-DEC-09 
    3                      10-DEC-09  16-DEC-09 
    6                      26-NOV-09  16-DEC-09 
    7                      29-JAN-09  16-DEC-09 
    The following error after the selection of a function that returns the table:
    select * from table(get_cwsr_ranges)
    Error from the 1 in the command line:
    Select * from table (get_cwsr_ranges)
    Error report:
    SQL error: ORA-06504: PL/SQL: return variables of the game results or the query types do not match
    ORA-06512: at "GET_CWSR_RANGES", line 23
    06504 00000 - "PL/SQL: return of the variable result set or query types do not match.
    * Cause: Numbers or types of columns in a query is not declared
    return type of a variable result is defined or declared two result types
    Set of variables do not match.
    * Action: Change the program or the declaration statement. Verify that the query variable
    actually we want during execution.
    >

    DDL:
    CREATE TYPE typ_date_range AS OBJECT
           (week_nbr                number,
            start_date              date,
            end_date                date   
          );
    /
    
     CREATE TYPE typ_tbl_date_ranges AS TABLE OF typ_date_range;
    /
    
    
    CREATE OR REPLACE FUNCTION get_cwsr_ranges()
    RETURN typ_tbl_date_ranges PIPELINED IS
    v_dates_table  typ_tbl_date_ranges;
    
    p_cursor     sys_refcursor;
    rec  typ_date_range := typ_date_range(NULL,NULL,NULL); 
    
    BEGIN
           
         open p_cursor for
         with sample_data as 
         (
             select 0 as  week_nbr , '29-JAN-09' as  start_date , '25-NOV-09' as end_date from dual union all                                         
             select 1 as  week_nbr , '26-NOV-09' as  start_date , '02-DEC-09' as end_date from dual union all                                         
             select 2 as  week_nbr , '03-DEC-09' as  start_date , '09-DEC-09' as end_date from dual union all                                         
             select 3 as  week_nbr , '10-DEC-09' as  start_date , '16-DEC-09' as end_date from dual union all                                         
             select 6 as  week_nbr , '26-NOV-09' as  start_date , '16-DEC-09' as end_date from dual union all                                         
             select 7 as  week_nbr , '29-JAN-09' as  start_date , '16-DEC-09' as end_date from dual  
       )
       select * 
       from sample_data;
        
    LOOP
        FETCH p_cursor INTO rec;
        EXIT WHEN p_cursor%NOTFOUND;
        PIPE ROW(Rec);
    END LOOP;
    CLOSE p_cursor;
    RETURN;
    
    END get_CWSR_Ranges;
    Any suggestions?
    create or replace FUNCTION get_cwsr_ranges
    RETURN typ_tbl_date_ranges PIPELINED
    IS
    
    BEGIN
    
      for rec in
      (
         with sample_data as
         (
             select 0 as  week_nbr , to_date('29-JAN-09', 'dd-mon-yy') as  start_date , to_date('25-NOV-09', 'dd-mon-yy') as end_date from dual union all
             select 1 as  week_nbr , to_date('26-NOV-09', 'dd-mon-yy') as  start_date , to_date('02-DEC-09', 'dd-mon-yy') as end_date from dual union all
             select 2 as  week_nbr , to_date('03-DEC-09', 'dd-mon-yy') as  start_date , to_date('09-DEC-09', 'dd-mon-yy') as end_date from dual union all
             select 3 as  week_nbr , to_date('10-DEC-09', 'dd-mon-yy') as  start_date , to_date('16-DEC-09', 'dd-mon-yy') as end_date from dual union all
             select 6 as  week_nbr , to_date('26-NOV-09', 'dd-mon-yy') as  start_date , to_date('16-DEC-09', 'dd-mon-yy') as end_date from dual union all
             select 7 as  week_nbr , to_date('29-JAN-09', 'dd-mon-yy') as  start_date , to_date('16-DEC-09', 'dd-mon-yy') as end_date from dual
        )
       select typ_date_range(week_nbr, start_date, end_date) the_type
       from sample_data
      )
      loop
        pipe row (rec.the_type);
      end loop;
    
    END get_CWSR_Ranges;
    

    and then...

    select *
    from table(cast(get_cwsr_ranges as typ_tbl_date_ranges))
    

    Published by: Tubby on December 26, 2009 19:05

    Remove the implicit conversion using explicit TO_DATE... you should always do :)

  • SQL (body of function from PL/SQL returning the SQL) query when you use to_char

    We are trying to build a page of Type SQL Query report (body of function from PL/SQL returning SQL query).
    our request is simple, to extract the month of the column recording_date.

    declare
    l_query varchar2 (1000);
    Start
    l_query: = 'select to_char (recording_date, 'MM') of re_productive;
    Return l_query;
    end;

    but we would like the following for this query problem

    Function returning SQL query: query cannot be parsed in the generator. If you believe that your query is syntactically correct, check the box of generic columns below the source of the region without analysis.
    (ORA-06550: line 4, column 42: PLS-00103: encountered the symbol "MY" what awaits one of the following values:.) (* @ % & = - +; <>/ at is mod remains not rem <>or! = or ~ = > = < = <>and or as between | multiset Member SUBMULTISET_ the symbol ".") was inserted before 'MY' to continue.)

    Notes:
    1 - the request is correct and it has been tested under sqlplus and toad.
    2. we tried option use generic name (analysis of query runtime only) column, but we get the same problem.


    any quick help please.

    Hello

    You have not escaped your quote in the string. Try this...

    DECLARE
    l_query VARCHAR2(32767);
    
    BEGIN
    
    l_query:= 'select to_char(recording_date,''MM'') from re_productive';
    
    RETURN l_query;
    
    END;
    

    See you soon

    Ben

  • DeskJet D4360: why my printer prints some lines in italics?

    I recently put in a new printer cartridge and now the printer prints some lines randomly on the page in italics.  Why?  How can I fix it?

    Hi Ba-rk , thanks for getting back to me!

    I hope you had a great weekend!

    If you make a copy of something from the glass as opposed to aprint without italics, the copy comes out with italics?

    I suggest to remove the cartridges and perform a power reset.  Unplug the power cord from the printer and the power outlet, then wait 60 seconds. After 60 seconds, plug back in the printer. Make sure that you connect the printer directly to a wall outlet. Make sure to bypass any surge protector or power bar.

    I recommend also to download and run the HP print and Scan doctor.

    Please hold me!

Maybe you are looking for