SQL column as a select to be referenced in a group of

Y at - it a rating or solution to be able to make reference to a column that is an "inline" select statement in a group by such described below? Group a will not alias. I also tried to do the SQL a MAX to remove the need for the reference group and this returned invalid expression.

SELECT DISTINCT hdr. BUSINESS_UNIT,
HDR. SESSN_ID,
HDR. STREAM_ROOT_ID,
HDR. SESSN_STS_CD,
HDR. SESSN_CRE_DTTM,
CASE
When C.OPRID <>' ' THEN C.OPRID
OF OTHER S.OPERATOR
END OPRID
STRM. QS_APP_CONTEXT,
RECV. QTY_SH_RECVD Quantity_Received,
CASE
WHEN hdr. BUSINESS_UNIT = "MFG01" THEN MAX (G.MFDS_SGRP_SIZE)
ANY OTHER MAX (S.SESSN_SGRP_SIZE)
END Quantity_Inspected,
Max (S.QS_VALUEREADING_1) Defect_Count,
CASE
WHEN MAX (S.QS_VALUEREADING_1) = 0 THEN ' '
ANY OTHER MAX (G.MFDS_NAME)
Characteristic of the END,
MAX (CMNT. QS_COMMENT2) COMMENTS.
STRM. INV_ITEM_ID,
ITM. DESCR,
STRM. WORK_CENTER_CODE,
STRM. VENDOR_ID,
* (SELECT V.NAME1 FROM PS_VENDOR V WHERE strm. VENDOR_ID = V.VENDOR_ID AND V.SETID = (SELECT PS_SET_CNTRL_REC SETID *)
WHERE RECNAME = "SELLER".
AND SETCNTRLVALUE = strm. $vendor_name BUSINESS_UNIT));
STRM. PRDN_AREA_CODE,
strm.COMPL_OP_SEQ,
STRM. PRODUCTION_TYPE,
C.RECEIVER_ID,
C.RECV_LN_NBR,
RECV. PO_ID,
RECV. LINE_NBR,
RECV. SCHED_NBR,
C.PRODUCTION_ID,
C.SERIAL_ID,
C.INV_LOT_ID
OF PS_QS_SESSN_HDR8 hdr
LEFT OUTER JOIN PS_QS_SESSN_TRACE8 C
THE hdr. BUSINESS_UNIT = C.BUSINESS_UNIT
AND hdr. SESSN_ID = C.SESSN_ID
LEFT OUTER JOIN PS_RECV_INSPDTL_VW RECV
ON C.BUSINESS_UNIT = RECV. BUSINESS_UNIT
AND C.RECEIVER_ID = RECV. RECEIVER_ID
AND C.RECV_LN_NBR = RECV. RECV_LN_NBR
LEFT OUTER JOIN PS_QS_STREAM_ROOT strm
THE hdr. STREAM_ROOT_ID = strm. STREAM_ROOT_ID
AND hdr. BUSINESS_UNIT = strm. BUSINESS_UNIT
LEFT OUTER JOIN PS_QS_STREAM8_VW G
THE strm. STREAM_ROOT_ID = G.STREAM_ROOT_ID
AND strm. BUSINESS_UNIT = G.BUSINESS_UNIT
LEFT OUTER JOIN PS_QS_SUBGROUP S
THE hdr. BUSINESS_UNIT = S.BUSINESS_UNIT
AND hdr. SESSN_ID = S.SESSN_ID
AND S.STREAM_ID = G.STREAM_ID
LEFT OUTER JOIN PS_QS_SESSN_COMM8 CMNT
WE S.BUSINESS_UNIT = CMNT. BUSINESS_UNIT
AND S.SESSN_ID = CMNT. SESSN_ID
AND S.STREAM_ID = CMNT. STREAM_ID
AND C.SAMPLE = CMNT. SAMPLE
LEFT OUTER JOIN PS_MASTER_ITEM_TBL itm
ON itm. INV_ITEM_ID = strm. INV_ITEM_ID
LEFT OUTER JOIN PS_SET_CNTRL_REC cntrl
ON itm. SETID = cntrl. SETID
AND cntrl. RECNAME = "MASTER_ITEM_TBL."
AND cntrl. SETCNTRLVALUE = strm. BUSINESS_UNIT
WHERE S.QS_VALUEREADING_1 = (SELECT MAX (S2. QS_VALUEREADING_1)
OF PS_QS_SUBGROUP S2
WHERE S2. BUSINESS_UNIT = S.BUSINESS_UNIT
AND S2. SESSN_ID = S.SESSN_ID
AND S2. STREAM_ID = S.STREAM_ID)
GROUP BY hdr. BUSINESS_UNIT,
HDR. SESSN_ID,
HDR. STREAM_ROOT_ID,
HDR. SESSN_STS_CD,
HDR. SESSN_CRE_DTTM,
C.OPRID,
S.OPERATOR,
STRM. QS_APP_CONTEXT,
RECV. QTY_SH_RECVD,
STRM. INV_ITEM_ID,
ITM. DESCR,
STRM. WORK_CENTER_CODE,
STRM. VENDOR_ID,
$VENDOR_NAME,
STRM. PRDN_AREA_CODE,
strm.COMPL_OP_SEQ,
STRM. PRODUCTION_TYPE,
C.RECEIVER_ID,
C.RECV_LN_NBR,
RECV. PO_ID,
RECV. LINE_NBR,
RECV. SCHED_NBR,
C.PRODUCTION_ID,
C.SERIAL_ID,
C.INV_LOT_ID

No, you must use the Group of against advice online. For example:

SQL> select  distinct deptno,
  2                   (select dname from dept d where d.deptno = e.deptno) dname,
  3                   job,
  4                   sum(sal)
  5    from  emp e
  6    group by deptno,
  7             dname,
  8             job
  9  /
           dname,
           *
ERROR at line 7:
ORA-00904: "DNAME": invalid identifier

SQL> select  distinct deptno,
  2                   dname,
  3                   job,
  4                   sum(sal)
  5    from  (
  6           select  deptno,
  7                   (select dname from dept d where d.deptno = e.deptno) dname,
  8                   job,
  9                   sal
 10             from  emp e
 11          )
 12    group by deptno,
 13             dname,
 14             job
 15  /

    DEPTNO DNAME          JOB         SUM(SAL)
---------- -------------- --------- ----------
        20 RESEARCH       MANAGER         2975
        30 SALES          MANAGER         2850
        10 ACCOUNTING     PRESIDENT       5000
        30 SALES          SALESMAN        5600
        10 ACCOUNTING     CLERK           1300
        10 ACCOUNTING     MANAGER         2450
        20 RESEARCH       ANALYST         6000
        20 RESEARCH       CLERK           1900
        30 SALES          CLERK            950

9 rows selected.

SQL> 

SY.

Tags: Database

Similar Questions

  • How do I rotate my result of a query from a line to a SQL column?

    Hey, guys:

    Is it possible that I can rotate my result of a query from a line to a SQL column?

    It's a certain type of pivot example
    Instead of
    DEPTNO DNAME
    -------- ---------------
    10 accounting
    It would be
    DEPTNO: 10
    DNOM: ACCOUNTING

    Hello

    When you have N columns to rank 1 and you want to display in the form of 1 column on several lines, it's called Unpivoting . Here's a way to do it:

    WITH     cntr     AS
    (
         SELECT     LEVEL     AS n
         FROM     dual
         CONNECT BY     LEVEL <= 2     -- number of columns to be unpivoted
    )
    SELECT     CASE c.n
             WHEN  1  THEN  'DEPTNO'
             WHEN  2  THEN  'DNAME'
         END || ':'        AS label
    ,     CASE c.n
             WHEN  1  THEN  TO_CHAR (d.deptno)
             WHEN  2  THEN  d.dname
         END || ':'        AS val
    ,     d.deptno               -- PK, if needed
    FROM         cntr        c
    CROSS JOIN  scott.dept  d
    WHERE   deptno = 10               -- or whatever
    ;
    

    The query above works in Oracle 9.1 or more.
    From Oracle 11.1, you can also use the SELECT... Function of the UNPIVOT operator.

  • How to remove the name of the column in the select clause

    Hello guys,.

    I want to just delete a column name in the select clause. Because I don't want to write all the names of columns. I hope I am.

    In other words, I want the following.
    Select   * - unwanted_column  from table;
    
    instead of this 
    
    Select col1, col2, col3, col4, ........ col 10000 from table;

    Hello

    There is nothing in SQL, which means "all columns * except *...» ». As others have said, the only way to achieve these results in SQL is to list all the columns you want.

    Your front end may have a feature that allows you to hide a specific column. For example, in SQL * Plus, you can use COLUMN... NOPRINT , like this:

    COLUMN      dname     NOPRINT
    
    SELECT       *
    FROM       scott.dept
    ORDER BY  dname
    ;
    

    Output:

    `   DEPTNO LOC
    ---------- -------------
            10 NEW YORK
            40 BOSTON
            20 DALLAS
            30 CHICAGO
    

    There is a column called dname in the scott.dept table; the query above uses actually. But, because of the order of the COLUMN, SQL * Plus will not display this column.

    Published by: Frank Kulash on February 26, 2013 10:10
    Example of scott.dept has changed.

  • Value of the item as column name to select

    Hello

    I have a problem with the selection of the columns in the query using elements. For example: I have a request:
    Select column_a table; or select table column_b;

    and I want to do something like this:
    n ' any item where I choose the column name
    -query: select column_from_item from the tale of

    Is this possible?
    My version of the apex: 4.0.2.00.07
    My version of db oracle: oracle 11g

    Hello

    Create a report... type... as a function returning the SQL statement...

    and then you source should be something like

    declare
       my_sql_statement varchar2(1000);
    begin
       my_sql_statement := 'select ' || :p1_x || ' from table';
       return my_sql_statement;
    end;
    

    Kind regards
    Shijesh

  • Apex error - maximum 100 columns can be selected

    Greetings!

    Version:
    Oracle 11.2
    Apex 4.1

    I have a classic dynamic report that brings back the result through a function. The result of the report presents data by week after your chosen dates. When the report has more than 100 columns, I get the error: "a maximum of 100 columns can be selected. Is there a way to avoid the 100 column limit in the report? Also is it possible to export the report to CSV file directly without getting this error in the report page?

    We intend to move to 4.2. This limit has been set to 4.2?

    Thank you
    SS

    code78 wrote:
    Greetings!

    Version:
    Oracle 11.2
    Apex 4.1

    I have a classic dynamic report that brings back the result through a function. The result of the report presents data by week after your chosen dates. When the report has more than 100 columns, I get the error: "a maximum of 100 columns can be selected. Is there a way to avoid the 100 column limit in the report? Also is it possible to export the report to CSV file directly without getting this error in the report page?

    Change your region report > under region Source > enter a number which corresponds to your need for maximum number of columns in the generic report

    You can create a custom procedure to generate data in csv format and print to the browser.

  • Select the anchor point of the Group and anchor it to the PointInsertion

    Hi all

    How to select the anchor point of the Group and dock it at the point of insertion of the document in indesign cs5.5 using javascript or vb.net

    You need get a reference to your group - call the myGroup - and the other to the PointInsertion where you want it anchored - call - the myIP. Given those, you can achieve your goal (in CS5 or later) by:

    myGroup.anchoredObjectSettings.insertAnchoredObject (myIP);

    You can specify a second parameter, if you want that specifies the position of anchor:

    myGroup.anchoredObjectSettings.insertAnchoredObject (myIP, AnchorPosition.anchored);

    That should help you get started.

    Dave

  • How to format the output of a .sql script that has select statements.

    Hello

    I have a .sql script which is having several select statements. Each Select statement is to have hundreds of Table columns.

    When we run the .sql script, we are unable to read the output.

    Please let know us the commands that we include for better readable output format.

    You work with the lin standard set 80.
    Increase this setting to set lin 3000 or more.

  • Need help with PL/SQL so and then select

    Hello guys, I am new to the PL/SQl programming (only Java experience) and I'm pretty stuck to my task. It would be great if you could help me. I am in programming with Oracle SQL * Plus Version 10.2.0.3.0

    Whenever a user logs on to the server a database entry is created with information about the logged-on user. I need to create a PL/SQL command that selects all the information from last month. Unfortunately, the date_stamp column has a certain weird format: 1131210 for December 10, 2013


    My idea so far:


    DECLARE

    v_today NUMBER;

    BEGIN

    v_today: = TO_NUMBER (TO_CHAR (SYSDATE, 'MM'));       -Save the number of the month (e.g.12) in v_today

    IF v_today = 01 THEN

    SELECT * from audittrl

    WHERE the date_stamp between 1131201 AND the 1131231;

    ELSIF v_today = 02 THEN

    SELECT * from audittrl

    WHERE the date_stamp between the 1130131 AND 1130101;

    .......

    END IF;

    END;

    /

    Error code: "an INTO clause in this SELECT statement.

    I do not want to save the result to select a variable, hope you can help me. Thanks in advance.

    Hello

    6a4d1bcd-c00e-4dac-AB64-9b6bdb1652d1 wrote:

    Thanks, I'll try that, if still get caught once, I'll be back. Anway I'm not sure of the solution of Chris227, because I can't test it right now. From my point of view it gives you information the current month (e.g., December) and not the month previous (-online November), or have I missed something. ?

    You are right.  In addition, it does not for a given year.  If you have data from several years in the table, it will select lines for the month of December 2012, 2011, 2010,... but also of 2013.

    Here's a way to get around that:

    DECLARE

    prev_month_start PLS_INTEGER: = TO_NUMBER (TO_CHAR (ADD_MONTHS (SYSDATE-1)

    , "YYMM"1' "01"

    )

    );

    this_month_start PLS_INTEGER: = TO_NUMBER (TO_CHAR (SYSDATE

    , "YYMM"1' "01"

    )

    );

    BEGIN
    FOR (IN) rec
    SELECT *.
    Of audittrl
    WHERE the date_stamp > = prev_month_start
    AND date_stamp< >
    ORDER BY user_id, date_stamp - or other

    )
    LOOP
    dbms_output.put_line (rec.date_stamp);
    dbms_output.put_line (rec.event);
    dbms_output.put_line (rec.user_id)
    dbms_output.put_line (rec.host_name);
    END LOOP;
    END;

    This should also be more effective, because it will allow the optimizer to use an index on date_stamp.  Even if there is no index, it will be more effective because it avoids calling any function (for example, SUBSTR) on each line of the table.

    You needn't PL/SQL to get these results.  Just use SQL, you might say:

    SELECT event, host_name, user_id and date_stamp
    Of audittrl
    WHERE the date_stamp > = TO_NUMBER (TO_CHAR (ADD_MONTHS (SYSDATE-1)
    , "YYMM"1' "01"
    )
    )
    AND date_stamp<  to_number="" (="" to_char="" (="" sysdate="" to_number="" (="" to_char="" (="">


    , "YYMM"1' "01"
    )
    )

    ORDER BY user_id, date_stamp - or other

    ;

    Your front end will provide column headers and touch the data so that the columns line up.  It can also set the output to a file.  (For example, if your front-end is SQL * Plus, you can use the command of the COIL.)

    I guess date_stamp is a NUMBER.  If it is a string, the solutions above can be simplified a bit.

    This problem (and many other problems) would be so much simpler if date_stamp was a DATE column.  Using numbers or strings to store the date information is simply asking for trouble.

  • NVARCHAR2 column in the select statement of the query


    Hello

    I have table

    xx_test / / DESC

    Name of Type Null

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

    COL1 NOT NULL NVARCHAR2 (100)

    COL2 NOT NULL NVARCHAR2 (100)

    COL3 NOT NULL NVARCHAR2 (100)

    I am able to interview

    Select * from xx_test

    However if the query as

    Select col1 from xx_test

    Then it is in error.

    ORA-00904: "COL1": invalid identifier

    00904, 00000 - '% s: invalid identifier '.

    * Cause:

    * Action:

    Error on line: column 3-131: 13

    Let me know how interrogate NVARCHAR2 column and how can we put in WHERE condition?

    Thank you

    Abhijit

    Abhijit,

    Now that you have already re-created the table, it would be difficult to find the exact cause. But I suspect it could happen due to the creation of table in a way not recommended the use of quotes.

    If you use double quotes while creating the table/column names, you must always use capital letters. Better is not not to use quotes in all. Here is an example of a test that could be the cause of your error.

    SQL > drop table test;

    Deleted table.

    SQL > create table test ("col1" nvarchar2 (200), col2 varchar2 (200));

    Table created.

    SQL > select Col1 from test;

    Select Col1 from test

    *

    ERROR on line 1:

    ORA-00904: "COL1": invalid identifier - it is him you got. Even if there is col1 column in the table, but I'm unable to select due to the bad way to appoint.

    SQL > drop table test;

    Deleted table.

    SQL > create table test ("COL1" nvarchar2 (200), col2 varchar2 (200));

    Table created.

    SQL >

    SQL > select col1 from test;

    no selected line

    The test case above apply to the tables as well.

    Ishan

  • Is it possible to use the record type or a PL/SQL table in the Select statement

    Hi all

    My requirement is that.
    I want to write a query and write a function, function, I want to return multiple columns at the same time in a Select statement.
    I select the return values in the Select no statement in a PL/SQL block.
    Is it possible to use the PL/SQL Table or Variable of Type record, or any other method in the statement Select?

    Please help me understand the solution.


    Kind regards

    830960 wrote:
    do we like it?

    In general, Yes, if the function is a function table, you can do something like:

    select  t.col1,
            t.col2,
            f.col1,
            f.col2,
            f.col3
      from  table_name t,
               table(some_table_function(param1,...paramN)) f
    /
    

    SY.

  • Calculation of layer of sql column

    V: 10.2.0.3

    I want to calculate column-layer of a sql query:
    select a "column1", "column1" + 1
    from ...
    but it does not work...
    Anyone know how?

    Hello

    If the function is declared as DETERMINISTIC, then it could be called only once, although you have coded the two calls.

    In general, you can call the function and give the result one alias, in a subquery. Then, in a super-requete, you can use this alias anywhere and as often as you want
    for example:

    WITH     got_column1     AS
    (
        SELECT  a (1, 2)      AS column1
        ,         ...
        FROM    actual_table
        ...
    )
    SELECT  column1
    ,     column1 + 1     AS column2
    ...
    FROM     got_column1
    ...
    
  • logic to be transformed into a table sql pl statement and select fill.

    create table emp (eno number, varchar2 (20) ename, sal number (10.2), dno number);

    create table emp_commision (eno number number dno, dname varchar2 (20), number (5.2)) of the commission.

    DECLARE
    TYPE EmpTabTyp1 IS TABLE OF THE emp % ROWTYPE directory INDEX;
    TYPE IS of EmpTabTyp2 TABLE emp_commision % ROWTYPE directory INDEX;
    emp_tab1 EmpTabTyp1;
    emp_tab2 EmpTabTyp2;

    C1 (p_dno number) cursor select eno, dno, dname, commission of emp_commision where dno = p_dno;
    number of l_num_index1;

    Start
    Select eno, ename, sal bulk collect into emp_tab1 from emp;
    I'm in emp_tab1.first... emp_tab1. Last
    loop
    If (emp_tab1 (i) .sal > 10000) then
    for l_rec_commision in c1 (emp_tab1.dno)
    loop

    l_num_index1: = (l_num_index1 + 1);
    emp_tab2 (l_num_index1) .commission: = l_rec_commision.commision;

    end loop;

    end if;
    end loop;
    while others then
    dbms_output.put_line (SQLERRM);
    end;
    /


    Requirement:

    For the same logic, I want to fill the table with the commission plsql emp_tab2, without using a cursor
    and two loops (loop) and the cursor for loop for. Sal > 10000 expected
    also be implemented.

    Others can be done in a single query.

    Thank you
    Vinodh

    ora_1978 wrote:
    Requirement:

    For the same logic, I want to fill the table with the commission plsql emp_tab2, without using a cursor
    and two loops (loop) and the cursor for loop for. Sal > 10000 expected
    also be implemented.

    Others can be done in a single query.

    Thank you
    Vinodh

    In addition there are errors in your code and it won't work, it is unclear what exactly you want as you have not explained with sample data and expected results.

    You select the number of columns to collect your in bulk.
    You collect the commission for an entire Department without regard to the employee for each employee record, so you would end up duplicating your data in your pl/sql collection (don't call them paintings, they are not really tables).
    You have not initialized l_num_index1 so it will never be incremented
    You have added an unnecessary error handler.
    etc.

    I'm guessing that you are looking for something in this direction...

    declare
      type EmpTabType2 is table of emp_commision%ROWTYPE index by binary_integer;
      emp_tab2 EmpTabType2;
    begin
      select ec.*
      bulk collect into emp_tab2
      from   emp e
             join emp_commision ec on (e.eno = ec.eno and e.dno = ec.dno)
      where  e.sal > 10000;
    end;
    

    ... but we can't really help without more information.

  • Column XMLTYPE to select a SEPARATE attribute increasing fom and...

    Hello
    I spent all day to find the solution without success. PLEAS HELP!
    The problem:
    1. I have table xmlType column in this column is the following xml code:
    < revision >
    < product id = 1 >
    < screws >
    < img id = 1 / >
    < / screws >
    < screws >
    < img id = 2 / >
    < / screws >
    < / product >
    < product id = 2 >
    < screws >
    < img id = 1 / >
    < / screws >
    < / product >
    < / revision >

    I have to select SEPARATE img ID and then select / join their form table relational (id (number), pic (blob)) img

    I can't find the solution to select the separate XML attribute values.

    I tried this:


    Select extract (c.xml, ' review/product/screw/img [not(@id=preceding-sibling::img/@id)] / @id') table c;

    Hello

    What is your version of the database?

    Recent versions, you can:

    SQL> create table test_xml (
      2   xml_data xmltype
      3  );
    
    Table created
    
    SQL>
    SQL> insert into test_xml (xml_data)
      2  values(xmltype('
      3  
      4  
      5  
      6  
      7  
      8  
      9  
     10  
     11  
     12  
     13  
     14  
     15  
     16  ')
     17  );
    
    1 row inserted
    
    SQL>
    SQL> select distinct x.img_id
      2  from test_xml t
      3     , xmltable(
      4        'revision/product/screw/img'
      5        passing t.xml_data
      6        columns img_id number path '@id'
      7       ) x
      8  ;
    
        IMG_ID
    ----------
             1
             2
    
    SQL>
    SQL> select x.img_id
      2  from test_xml t
      3     , xmltable(
      4        'for $i in distinct-values(revision/product/screw/img/@id)
      5         return $i'
      6        passing t.xml_data
      7        columns img_id number path '.'
      8       ) x
      9  ;
    
        IMG_ID
    ----------
             1
             2
     
    
  • dynamic SQL - column not allowed

    Hi, I had a problem about the dynamic SQL. could someone help me? Thank you.


    TableName: = Init;
    ID: = 1;


    Statement: = "insert" | TableName. "values (' |)" ID | ', mdsys.sdo_geometry (3007, null, null,)
    MDSYS.sdo_elem_info_array (1,1003,1,
    13,1003,1,
    25,1003,1,
    37,1003,1,
    49,1003,1,
    61,1003,1,
    73,1003,1,
    85,1003,1,
    97,1003,1,
    109,1003,1,
    121,1003,1,
    133,1003,1,
    145,1003,1,
    157,1003,1,
    169,1003,1,
    181,1003,1,
    193,1003,1,
    205,1003,1,
    217,1003,1,
    229,1003,1,
    ((241,1003,1), anoCone))';

    EXECUTE IMMEDIATE statement.


    error: column not allowed

    But if I use static SQL (i.e. INSERT INTO Init...), it not there no problem at all.

    Well, I still have no idea why you are wanting to use dynamic SQL statements for this (it will only add a memory load, especially if your routine is frequently called) but I have at least understood your problem.

    The first anonymous block shows using the static SQL, the second shows how to use dynamic (and you reference a declared local variable, where your problem is).

    SQL> select count(*) from object1;
    
              COUNT(*)
    ------------------
                     0
    
    Elapsed: 00:00:00.01
    SQL> declare
         anoCone     MDSYS.SDO_ORDINATE_ARRAY;
    begin
    
    insert into OBJECT1
    values
    (
         1,
         mdsys.sdo_geometry(3007, null, null,
    mdsys.sdo_elem_info_array (1,1003,1,
    13,1003,1,
    25,1003,1,
    37,1003,1,
    49,1003,1,
    61,1003,1,
    73,1003,1,
    85,1003,1,
    97,1003,1,
    109,1003,1,
    121,1003,1,
    133,1003,1,
    145,1003,1,
    157,1003,1,
    169,1003,1,
    181,1003,1,
    193,1003,1,
    205,1003,1,
    217,1003,1,
    229,1003,1,
    241,1003,1),
    anoCone));
    
    end;
    /
    
      2    3    4    5    6    7    8    9   10   11   12   13   14   15   16   17   18   19   20   21   22   23   24   25   26   27   28   29   30   31   32   33   34
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:00.00
    SQL> SQL>
    SQL> select count(*) from object1;
    
              COUNT(*)
    ------------------
                     1
    
    Elapsed: 00:00:00.01
    SQL> roll
    Rollback complete.
    SQL> select count(*) from object1;
    
              COUNT(*)
    ------------------
                     0
    
    Elapsed: 00:00:00.01
    SQL> declare
         anoCone     MDSYS.SDO_ORDINATE_ARRAY;
    begin
    
    execute immediate 'insert into ' || 'OBJECT1' || '
    values
    (
         1,
         mdsys.sdo_geometry(3007, null, null,
    mdsys.sdo_elem_info_array (1,1003,1,
    13,1003,1,
    25,1003,1,
    37,1003,1,
    49,1003,1,
    61,1003,1,
    73,1003,1,
    85,1003,1,
    97,1003,1,
    109,1003,1,
    121,1003,1,
    133,1003,1,
    145,1003,1,
    157,1003,1,
    169,1003,1,
    181,1003,1,
    193,1003,1,
    205,1003,1,
    217,1003,1,
    229,1003,1,
    241,1003,1),
    :anoCone)) ' using anoCone;
    
    end;
    /
      2    3    4    5    6    7    8    9   10   11   12   13   14   15   16   17   18   19   20   21   22   23   24   25   26   27   28   29   30   31   32   33   34
    PL/SQL procedure successfully completed.
    
    Elapsed: 00:00:00.01
    SQL>
    select count(*) from object1;SQL> 
    
              COUNT(*)
    ------------------
                     1
    
    Elapsed: 00:00:00.01
    SQL> 
    
  • Generate CSV with pl.sql column names

    Hi guys,.

    Well, I am back after a long hiatus in this form, was occupied by SAP BI project.

    Now do some oralce - sap project, well here, I needed to generate a CSV of many many queries,

    I can do via sql, but I tot it would be better to write a package or a common procedure to generate csv files

    ex, if I pass the query to the proceudre it should generate csv on the server directory file, later I send these file to the users concerned.

    The e-mail part is later, but first of all is to have a package of generic to launch and run the query n generate the csv file.

    I guess this should be possible using native dynamic sql and utl_ package, but I don't know how to get the columns name,

    If one has implemented this please explain me the way,.

    ex:
    Select emp,mgr, empno from emp;
    
    emp mgr empno
     1    1    123
      2   1    234
    
    something like that
    hope my question is clear 

    Maybe try this

    http://asktom.Oracle.com/pls/asktom/asktom.download_file?p_file=6551135514501758779

Maybe you are looking for

  • My space bar brings out all of a sudden rather than move to the bottom of the page

    I change all the settings [but I might have hit an f key, not know], and all of a sudden instead of paging down to hit the space bar highlights the green stuff. It's really weird, and I want my page to the bottom of the back.

  • Firefox will not open my email. default.aspx appears

    Need me for my hotmail, but after I entered my name and password default.aspx appears and which is as far as I can get

  • Satellite Pro L770-149 - cannot get working Wlan

    Hello I recently rebuilt a Toshiba Satellite Pro L770-149 with windows 7 64 bit, when I installed first the operating system, all the drivers were missing so I installed all of the correct drivers and had run as it was before. Form Apart wireless con

  • A Wi - Fi connection does not turn off correctly

    When I turn off Wi - Fi in the quick toggle or settings page it does not turn off and it is left running. (I have not 'analysis always' either) I can see in the graph of the battery when I turn it off for a while it always shows the green bar on Wi -

  • Routing and remote access to the Server 2003

    I configured the remote access and routing service in my Server 2003 duly NAT enabled. All my clients are not in the field. All use internet and intranet connection using my proxy authentication provided by the administrator of the proxy server. I wo