Select the data if a value has a certain value?

Hello, I'm trying to do...


In pseucode, it looks like to...

If this field has a value, then select a, b, c,... of table
another "don't do anything".

How can I do that, I tried...

Select decode (LKP2. EXCLUDED_BOOK_CD, not null,
(select 1 double),
('NOT NULL', 'ALL')
OF LKP2 fcl_chunk_pid_correspondence
WHERE LKP2. CHUNK_ID =: p_chunk_id
AND LKP2. GCDS_ENTITY = "TRANSACTION".
AND LKP2. EXCLUDED_BOOK_CD IS NOT NULL
AND LKP2. UBR = "OTHER";

But this does not work if there is not any row for where.

Thanks in advance!

write a case statement as

Select the case while sal is not null, then end of sal from emp;

Tags: Database

Similar Questions

  • Select the data in a table and update in another table

    Dear experts,

    create the table TB_ENCRYPT

    (

    Identification number,

    Varchar2 (200) KEY

    );

    INSERT INTO TB_ENCRYPT VALUES(1,'HJUVHDUIFBSDGVU');

    SELECT * FROM TB_ENCRYPT;

    1 HJUVHDUIFBSDGVU

    create TABLE users)

    username, NUMBER of

    password VARCHAR2 (200)

    );

    Insert users

    values (1, 123 # "")

    Insert users

    values (2, 456 #')

    Select * from users;

    1 123 #.

    # 2 456

    I want to select the data KEY for table TB_ENCRYPT column and update in the column of tables for the respective key user password

    TB_ENCRYPT table contains only a single key value. Comparing this key, I want to update the old value of the key to the new value.

    For encryption and decryption I followed the java class method.no is worried about that.

    create or replace

    PACKAGE PCK_ENC AUTHID CURRENT_USER AS

    FUNCTION DECRYPT (VARCHAR arg0, arg1 VARCHAR) AS VARCHAR BACK LANGUAGE JAVA NAME 'Encrclass.decrypt (java.lang.String, java.lang.String) return java.lang.String ';

    FUNCTION ENCRYPT (VARCHAR arg0, arg1 VARCHAR) AS VARCHAR BACK LANGUAGE JAVA NAME 'Encrclass.encrypt (java.lang.String, java.lang.String) return java.lang.String ';

    END;

    SELECT PCK_ENC. ENCRYPT('1234','HJUVHDUIFBSDGVU') FROM DUAL;

    HERE,

    1234 - is the password of the users table column data

    HJUVHDUIFBSDGVU - represents the key of table TB_ENCRYPT column data.

    Comparing this key, I want to update the old value of the key to the new value.

    I tried with this method

    declare

    cursor c1 is

    Select the key

    of TB_ENCRYPT

    where id = 1

    update the id;

    Start

    for c1_rec looping c1

    update users

    password is PCK_ENC. Encrypt (Password, Key)

    the location being c1;

    commit;

    end loop;

    end;

    /

    Help, please

    You can use the MERGE statement.

    merge into users
    using tb_encrypt
       on (id = userid)
      when matched then
          update set password = PCK_ENC.ENCRYPT(password,key);
    

    And why you encrypt your password. This isn't a good idea. Just password hash.

  • outer join while selecting the date max

    Hello
    Oracle 11g R2.

    I want to build a query that joins outside between 2 related tables, but selects only the date max if more than 1 record returned for a given customer. Here are the tables I and some records.

    create table customer (NumCli number, name varchar2 (100))
    create table orders (ordnum number, NumCli number, date orddate)

    insert into customers values (1, 'ABC')
    insert into customer values (2, 'DEF')
    insert into customer values (3, 'ABC')
    insert into customer values (4, 'DEF')

    insert into orders values (1, 1, sysdate)
    insert into orders values (2, 1, sysdate + 1)
    insert into orders values (3, 2, sysdate + 2)

    I created the following query, but it returns the two dates for NumCli = 1. I want to display the name of the client no matter if he has a prescription. But if there is more order, I want display the folder with the date max.

    Select a.custnum, b.SID, b.orddate
    client a, b of orders
    where a.custnum = b.custnum (+)
    and b.orddate (+) < = sysdate + 10 - additional criteria as part of the edition

    It is a simplified example of a more complex query, that I am trying to solve. If possible, could you please suggestion a request without the use of analytical functions or inline views?
    Thank you!!

    Published by: arizona9952 on April 4, 2013 22:05

    arizona9952 wrote:
    Thanks Jac. Any way to do this without a group of?

    Is there a particular reason not to use MAX?

    It will be difficult to find a maximum date without a group of... If it's ok for you to have everything available, you can use the correlated sub query...

    select a.custnum, a.name,
             (
               select b.orddate
               from   orders b
               where b.custnum = a.custnum
               and b.orddate <= sysdate + 10
               and rownum = 1 ) ordddate
    from customer a
    
  • With the help of case condition for the date of distinct values is does not

    Hello PL/SQL gurus and experts.

    I use Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64-bit Production version
    I followed two tables

    TT3-
    create table TT3(FeesCntlr,CommCntlr,LatePayCntlr,Name,Age) as select
    1,11,21,'Mike',25 from dual union all select
    2,12,22,'Clark',26 from dual union all select
    4,17,27,'Ussan',28 from dual union all select
    5,13,21,'Linda',29 from dual union all select
    6,14,24,'Obrek',35 from dual union all select
    7,15,25,'Batty',45 from dual union all select
    8,16,26,'Nicky',38 from dual;
    TT4
    drop table TT4;
    create table TT4(TRNID,BlockID,FeesCntlr,CommCntlr,LatePayCntlr,BookDate) as select
    221,625,1,11,21,20121101 from dual union all select
    223,625,2,12,22,20121101 from dual union all select
    224,625,1,11,21,20121101 from dual union all select
    225,627,4,17,27,20111001 from dual union all select
    226,628,5,13,21,20120701 from dual union all select
    227,628,6,14,24,20120701 from dual union all select
    334,628,7,15,25,20120701 from dual union all select
    339,629,8,16,26,20120701 from dual union all select
    393,629,1,11,21,20120701 from dual union all select
    432,629,2,12,22,20120701 from dual union all select
    347,629,1,11,21,20120701 from dual union all select
    556,629,4,17,27,20120701 from dual union all select
    558,629,5,13,21,20120701 from dual union all select
    974,629,6,14,24,20120701 from dual union all select
    976,629,7,15,25,20120701 from dual union all select
    980,629,8,16,26,20120701 from dual union all select
    1223,650,2,12,22,20110415 from dual union all select
    1224,650,1,11,21,20110415 from dual union all select
    1225,650,4,17,27,20110415 from dual union all select
    1226,650,5,13,21,20110415 from dual union all select
    1227,650,6,14,24,20110415 from dual union all select
    1334,650,7,15,25,20110415 from dual union all select
    1339,710,8,16,26,20120115 from dual union all select
    1393,710,1,11,21,20120115 from dual union all select
    1432,710,2,12,22,20120115 from dual union all select
    1347,710,1,11,21,20120115 from dual union all select
    1556,710,4,17,27,20120115 from dual union all select
    1558,711,5,13,21,20111231 from dual union all select
    1974,711,6,14,24,20111231 from dual union all select
    1976,711,7,15,25,20111231 from dual ;
    Now, if I use the following DML for the year 2012, then the result is as follows-
    SQL> select t3.Name,t3.age,count(t4.TRNID),count(distinct(BlockID)) from
      2  tt3 t3,tt4 t4
      3  WHERE     t3.feescntlr = t4.feescntlr
      4           AND t3.commcntlr = t4.commcntlr
      5           AND t3.latepaycntlr = t4.latepaycntlr
      6    AND t4.bookdate between 20120101 and 20121120
      7  GROUP BY t3.name, t3.age;
    
    NAME         AGE COUNT(T4.TRNID) COUNT(DISTINCT(BLOCKID))
    ----- ---------- --------------- ------------------------
    Mike          25              12                        3
    Mike          27              12                        3
    Batty         45               4                        2
    Clark         26               6                        3
    Linda         29               4                        2
    Nicky         38               6                        2
    Obrek         35               4                        2
    Ussan         28               4                        2
    
    8 rows selected.
    Now, if I use the following DML for 2011, then the result is as follows-
    SQL> select t3.Name,t3.age,count(t4.TRNID),count(distinct(BlockID)) from
      2  tt3 t3,tt4 t4
      3  WHERE     t3.feescntlr = t4.feescntlr
      4           AND t3.commcntlr = t4.commcntlr
      5           AND t3.latepaycntlr = t4.latepaycntlr
      6    AND t4.bookdate between 20110101 and 20111120
      7  GROUP BY t3.name, t3.age;
    
    NAME         AGE COUNT(T4.TRNID) COUNT(DISTINCT(BLOCKID))
    ----- ---------- --------------- ------------------------
    Mike          25               2                        1
    Mike          27               2                        1
    Batty         45               2                        1
    Clark         26               2                        1
    Linda         29               2                        1
    Obrek         35               2                        1
    Ussan         28               4                        2
    
    7 rows selected.
    But by using the condition if I use the following dml and results do not match-
    SQL> select Name,Age,sum(Trn),sum(CurYrOrdr) "2011 Order", sum(LastYrOrdr) "2012 Order"
      2  from
      3  (
      4  select t3.Name,t3.age,count(t4.TRNID) Trn,(case when t4.bookdate between 20110101 and 20111231 
    then count (distinct(BlockID)) else 0 end) CurYrOrdr,
      5  (case when t4.bookdate between 20120101 and 20121120 then count (distinct(BlockID)) else 0 end)
     LastYrOrdr
      6   from
      7  tt3 t3,tt4 t4
      8  WHERE     t3.feescntlr = t4.feescntlr
      9           AND t3.commcntlr = t4.commcntlr
     10           AND t3.latepaycntlr = t4.latepaycntlr
     11    AND t4.bookdate between 20110101 and 20121120
     12  GROUP BY t3.name, t3.age,t4.bookdate
     13  )
     14  group by Name,Age order by Name,Age;
    
    NAME         AGE   SUM(TRN) 2011 Order 2012 Order
    ----- ---------- ---------- ---------- ----------
    Batty         45          8          2          2
    Clark         26          8          1          3
    Linda         29          8          2          2
    Mike          25         14          1          3
    Mike          27         14          1          3
    Nicky         38          6          0          2
    Obrek         35          8          2          2
    Ussan         28          8          2          2
    
    8 rows selected.
    As the expected output, that I expect - is
    ----------------------------------
    
    Expected Output -
    NAME         AGE      "2012 TRNID"       "2011 TRNID"     "2012 ORDERID"     "2011 ORDERID"
    ----- ---------- --------------- ----------------------------- ---------- ------------
    Mike          25        12          2               3          1
    Mike          27        12              2          3          1
    Batty         45        4               2              2          1
    Clark         26        6               2              3          1
    Linda         29        4               2              2          1
    Nicky         38        6               2              2          1
    Obrek         35        4               2              2          1
    Ussan         28        4               4              2          2
    I sincerely thank each of you in advance for the input/comments that I fight with it for some time now.
    Kindly help.

    user555994 wrote:
    Hi JAC
    Thanks for the comments and certainly once I comment out the following line.
    - AND t4.bookdate between 20110101 and 20111120

    then the values are adapting, but at the same time why do we need to comment the date range condition as case is just a filter and not the condition.

    filter should be-

    AND t4.bookdate between 20110101 and 20121120 --"made it 12"
    
  • Select the data in user_cons, user_constraints, user_cons_columns

    Dear Sirs, I want to select the name of the table and its referential tables and constraint_names and column used in this referencial constraints
    I use this selection, but it doesn't look good
    Select t.table_name, t.ref_name, c.constraint_name, m.column_name
    of user_cons t, user_constraints c, user_cons_columns m
    where
    c.table_name = t.table_name
    and m.table_name = c.table_name
    and m.constraint_name = c.constraint_name
    and constraint_type = 'R '.
    and c.table_name like '% STK '.
    order of table_name, constraint_name


    Please help me
    Yasser

    Yasser,

    Try this SQL.

    SELECT A.TABLE_NAME CHILD_TABLE_NAME, D.TABLE_NAME MASTER_TABLE_NAME, A.CONSTRAINT_NAME CHILD_CONSTRAINT_NAME, A.R_CONSTRAINT_NAME MASTER_CONSTRAINT_NAME, C.COLUMN_NAME CHILD_COLUMN, D.COLUMN_NAME MASTER_COLUMN
    FROM USER_CONSTRAINTS A, USER_CONS_COLUMNS C, USER_CONS_COLUMNS D
    WHERE A.CONSTRAINT_NAME = C.CONSTRAINT_NAME AND A.R_CONSTRAINT_NAME = D.CONSTRAINT_NAME AND A.TABLE_NAME LIKE 'STK%'
    ORDER BY A.TABLE_NAME, A.CONSTRAINT_NAME
    

    Kind regards

    Manu.

    If my answer or the answer to another person has been useful or appropriate, please mark accordingly

    Published by: Manu. April 27, 2010 15:19

  • How to select the data that meet multiple criteria

    name load_date
    -------- ----------------
    Smith 11/02/2010
    John 01/10/2009
    Cindy 03/04/2010
    Smith 03/10/2010


    I want to select all names including load_date exist in February AND March.

    Expected results: -.

    Smith

    I can use the intersect operator to get all the names that were given in February AND March by using the following query.

    Select the name of the table where to_char ("load_date, ' FMMonth YYYY") = "February 2010"»
    intersect
    Select the name of the table where to_char ("load_date, ' FMMonth YYYY") = "March 2010"»


    Y at - it an easier way to retrieve the same data that is similar to the use group by, having cluase etc?

    Thanks in advance.

    Hello

    You can do it in one pass through the table with GROUP BY and HAVING:

    SELECT       name
    FROM       table_x
    WHERE       load_date     >= DATE '2010-02-01'     -- First date inside target range
    AND       load_date     <  DATE '2010-04-01'     -- First date OUTSIDE target range
    GROUP BY  name     -- not TRUNC (load_date, 'MONTH')
    HAVING       COUNT (DISTINCT (TRUNC (load_date, 'MONTH')))     = 2
    ;
    

    Try to keep the columns indexed by themselves in comparisons; in this way, you can use indexes.
    For example, if there is an index on load_date, then the above query could use, as load_date is only on one side of the > = or<>
    A similar State

    where   to_char (load_date, 'FMMonth YYYY') = 'February 2010'
    

    cannot use an index on load_date, because we do not compare load_date - we compare the results of TO_CHAR (load_date,...).

    Published by: Frank Kulash, April 13, 2010 16:44
    Fixed GROUP BY clause

  • SELECT the data inserted into a global temporary Table in a stored proc

    A stored procedure is run from Oracle SQL Developer to insert data into a global temporary table. A SQL (in Oracle SQL Developer) worksheet is open to run a SELECT query to retrieve the data from the temporary table overall which was populated in the stored procedure. No row is returned. I guess it's because the stored procedure and the SELECT statement executed in different sessions.

    Is it possible to run the stored procedure in Oracle SQL Developer and then execute a select statement on the temporary table overall which was filled in the stored procedure by using the same connection so that the data can be extracted?

    I use version 1.5.1 build HAND-5440 of Oracle SQL Developer.

    In a worksheet, do something like

    Start
    insert_proc;
    end;

    Select * from my_temp_table;

    Place the cursor on each statement in turn and Press f9 (where it all began... the end is a single statement.

  • Numbers automatically selects the "date format" for cells.

    Numbers automatically format selects 'date' of certain cells.

    I need "numbers."

    I want to calculate simple interest due on the amount, the interest rate and number of days.

    When I input "number" format of the result cell and calculate the amount * rate * number of days divided by 365 always automatically shows something unwanted and the format "date." Furthermore, I'm not able to change the AutoFormat ("date") in "number".  How to bypass this automatic selection?

    Thanks in advance

    UbiUbu

    Maybe you can share what, exactly, you enter in a cell.  A screenshot is also useful.

    Here's a way to do what I think you want:

    Enter amounts in cells B1, B2 and B3

    Select cell B6, and type (or copy and paste it here) the formula:

    =B2*B3*B1/365.25/100

    shortcut for this is:

    B6=B2*B3*B1/365.25/100

  • Select the date of

    Hello

    We command 'Select Date' in the front panel control palette, when you click that opens in windows "Set Date and time".

    Is it possible to call the "Set Date and time" window without using the control date selection.

    Thanks and greetings

    Rohith M P

    cancancanopen wrote:

    But to my knowledge, I wanted to know where in the LabVIEW 'Date and time Set' directory will be available.

    The VI is called "picktime.vi" and it is located in the directory "\resource\dialog".

  • Select the data in a time

    Hello

    I'm new to OBIEE and I'm struggling with something.

    I have two columns, one is all filled with dates and other numbers.

    I just wanto to select only numbers since just last month. How can I add this filter?

    Thank you

    Ah!

    If your condition is much easier

    "since just last month" for me what it wanted to say from the 1st to the last day of the previous month.

    Yes, you got it right with "timestampadd (SQL_TSI_MONTH,-1, current_date)" be aware that it does not mean "last 30 days".

    When you're in March he will be only 28 or 29 days (if 29 Feb there exists this year) and the same months have 31 days.

  • The date ranges whose value is on two different reporting periods

    I have a SQL puzzle. How Can I with a single SQL statement GB of data like this to a reduced set of data knowing that a simple use of min/max does not correctly report 9494 x TVALUE is actually on two distinct periods separated by the 26202 x TVALUE. I messed around by using the analytical functions of the Oracle of lead and lag to see if if she me net anything or to reveal at least one model that I could take advantage of. It is probably with myself, but I'm not.

    Any ideas?

    EMPNO TVALUE TSTART TEND
    "1234", "x 9494" 11/5/2007 12/5/2009 ".
    "1234", "26202 x" 12/6/2009-4/30/2010 "»
    "1234", "x 9494" 5/1/2010 8/18/2011 "»

    OF THIS

    EMPNO TVALUE TLAG TLEAD TSTART TEND
    "1234" "0" '0""0' 10/16/2000-5/30/2002
    "1234", "x 493" "0" "x 493" 5/31/2002-9/20/2003 ' "»
    "1234" "x 493" "x 493" 'x 493' 9/21/2003-11/1/2003 ' "»
    "1234", "x 493" "x 493" '0' 11/2/2003-4/17/2005 ' "»
    "1234", "x 5821" "0" "x 5821" 4/18/2005-9/2/2006 "". "
    "1234' ' x 5821" "x 5821" "x 5821" 9/3/2006-2/9/2007 "' '". "
    "1234' ' x 5821" "x 5821" "x 5821" 2/10/2007-7/7/2007 "' '". "
    "1234", "x 5821" "x 5821" '0' 7/8/2007 11/4/2007 ' "»
    "1234", "x 9494" "0" "x 9494" 11/5/2007-5/9/2008 ' "."
    "1234' ' x 9494" "x 9494" 'x 9494' 5/10/2008-12/20/2008 ' "."
    "1234' ' x 9494" "x 9494" "x 9494" 21/12/2008-12/31/2008 "' '". "
    "1234" "x 9494" "x 9494" "x 9494" 1/1/2009, 5/12/2009 "" "" "
    "1234", "x 26202" '0""0' 12/6/2009-4/30/2010 "»
    "1234", "x 9494" "x 9494" '0' 5/1/2010 8/18/2011 ""»
    "1234", "x 3718" "0" "0" "8/19/2011-10/22/2011.
    "1234", "x 76364" '0""0' 10/23/2011-12/31/4712 "»

    FOR THIS

    EMPNO TVALUE TSTART TEND
    '1234' '0' 10/16/2000-5/30/2002
    "1234", "x 493" 5/31/2002-4/17/2005 ".
    "1234", "x 5821" 4/18/2005-11/4/2007 "»
    "1234", "x 9494" 11/5/2007 12/5/2009 ".
    "1234", "26202 x" 12/6/2009-4/30/2010 "»
    "1234", "x 9494" 5/1/2010 8/18/2011 "»
    "1234", «x 3718 "8/19/2011-10/22/2011"»
    "1234", "x 76364" 10/23/2011-12/31/4712 "»

    Ok. I think I understand your question now. I need to use the 'beginning of a group method:

    with sample_table as (
                          select '1234' empno,'0' tvalue,'0' tlag,'0' tlead,to_date('10/16/2000','mm/dd/yyyy') tstart,to_date('5/30/2002','mm/dd/yyyy') tend from dual union all
                          select '1234','x493','0','x493',to_date('5/31/2002','mm/dd/yyyy'),to_date('9/20/2003','mm/dd/yyyy') from dual union all
                          select '1234','x493','x493','x493',to_date('9/21/2003','mm/dd/yyyy'),to_date('11/1/2003','mm/dd/yyyy') from dual union all
                          select '1234','x493','x493','0',to_date('11/2/2003','mm/dd/yyyy'),to_date('4/17/2005','mm/dd/yyyy') from dual union all
                          select '1234','x5821','0','x5821',to_date('4/18/2005','mm/dd/yyyy'),to_date('9/2/2006','mm/dd/yyyy') from dual union all
                          select '1234','x5821','x5821','x5821',to_date('9/3/2006','mm/dd/yyyy'),to_date('2/9/2007','mm/dd/yyyy') from dual union all
                          select '1234','x5821','x5821','x5821',to_date('2/10/2007','mm/dd/yyyy'),to_date('7/7/2007','mm/dd/yyyy') from dual union all
                          select '1234','x5821','x5821','0',to_date('7/8/2007','mm/dd/yyyy'),to_date('11/4/2007','mm/dd/yyyy') from dual union all
                          select '1234','x9494','0','x9494',to_date('11/5/2007','mm/dd/yyyy'),to_date('5/9/2008','mm/dd/yyyy') from dual union all
                          select '1234','x9494','x9494','x9494',to_date('5/10/2008','mm/dd/yyyy'),to_date('12/20/2008','mm/dd/yyyy') from dual union all
                          select '1234','x9494','x9494','x9494',to_date('12/21/2008','mm/dd/yyyy'),to_date('12/31/2008','mm/dd/yyyy') from dual union all
                          select '1234','x9494','x9494','x9494',to_date('1/1/2009','mm/dd/yyyy'),to_date('12/5/2009','mm/dd/yyyy') from dual union all
                          select '1234','x26202','0','0',to_date('12/6/2009','mm/dd/yyyy'),to_date('4/30/2010','mm/dd/yyyy') from dual union all
                          select '1234','x9494','x9494','0',to_date('5/1/2010','mm/dd/yyyy'),to_date('8/18/2011','mm/dd/yyyy') from dual union all
                          select '1234','x3718','0','0',to_date('8/19/2011','mm/dd/yyyy'),to_date('10/22/2011','mm/dd/yyyy') from dual union all
                          select '1234','x76364','0','0',to_date('10/23/2011','mm/dd/yyyy'),to_date('12/31/4712','mm/dd/yyyy') from dual
                         ),
                   t1 as (
                          select  empno,
                                  tvalue,
                                  tstart,
                                  tend,
                                  case lag(tvalue) over(partition by empno order by tstart,tend)
                                    when tvalue then 0
                                    else 1
                                  end start_of_group
                            from  sample_table
                         ),
                   t2 as (
                          select  empno,
                                  tvalue,
                                  tstart,
                                  tend,
                                  sum(start_of_group) over(partition by empno order by tstart,tend) grp
                            from  t1
                         )
    select  empno,
            tvalue,
            min(tstart) tstart,
            max(tend) tend
      from  t2
      group by grp,
               empno,
               tvalue
      order by tstart,
               tend
    /
    
    EMPN TVALUE TSTART     TEND
    ---- ------ ---------- ----------
    1234 0      10/16/2000 05/30/2002
    1234 x493   05/31/2002 04/17/2005
    1234 x5821  04/18/2005 11/04/2007
    1234 x9494  11/05/2007 12/05/2009
    1234 x26202 12/06/2009 04/30/2010
    1234 x9494  05/01/2010 08/18/2011
    1234 x3718  08/19/2011 10/22/2011
    1234 x76364 10/23/2011 12/31/4712
    
    8 rows selected.
    
    SQL> 
    

    SY.

  • Select the data from collections plsql

    Hi all

    I'm not a developer but working as a DBA, so not very familiar with pl/sql, always crossed with documentation and could lead to a solution of my problem. I need advice from expert here.

    Problem: I am writing in a kind of special program plsql for surveillance of certain lots, I know that we have much option to do the same db/grid control including... etc but for some
    the reason I have to do this, use only plsql.

    Requirement: my requirement is to select data in the plsql table and then have the opportunity to ask questions again and again. I prefer not to go to table, rather than directly from plsql...

    I wrote below the code for the sample, bulk data in collection type collection and can print using the loop.

    Declare
    TS type is table v$ session % rowtype index by pls_integer;
    tsess ts.
    Start
    Select * bulk collect into tsess from v$ session;
    I'm looping 1.tsess.count
    dbms_output.put_line (tsess (i) .terminal);
    end loop;
    end;
    /

    But is it possible same collection (tsess in the example above) can be queried using a select as ' select * from table (Tsess) "I searched the net and found this can be done using create type at the database level.» But my problem is that I can't create any object in the database as being it's a production one.

    I was looking as if is it possible even can be accomplished... as cast / multiset... However, I could not get it through.

    your help would be appreciated!

    Kind regards

    I don't think you should use the tables here, only SQL, take a look at the factors of subquery and will indicate if it is not enough...

    Published by: BrendanP on February 12, 2012 03:07 for an example:

    I understand you want to "Refresh" of data that you already have the database purely to be able to use the SQL such as ORDER BY in multiple ways. Here's how you can do it in the original SQL for a particular example, where you query v$ sql time control processor and disk reads separately (I tested it but the result won't be good look here, so omitting it):

    WITH v AS (
    SELECT
        Substr (sql_text,1,500)             sql_text,
        cpu_time/1000000                    cpu_seconds,
        disk_reads,
        buffer_gets,
        executions,
        CASE WHEN rows_processed != 0 THEN Round( buffer_gets / Nvl (Replace (rows_processed, 0, 1) ,1)) END Buffer_gets_rows_proc,
        Round (buffer_gets / Nvl (Replace (executions, 0, 1), 1)) Buffer_gets_executions,
        elapsed_time / 1000000              elapsed_second,
        module
    FROM v$sql s)
    SELECT
        'CPU'                order_by,
        cpu_seconds          order_val,
        sql_text,
        cpu_seconds,
        disk_reads,
        buffer_gets,
        executions,
        buffer_gets_rows_proc,
        buffer_gets_executions,
        elapsed_second,
        module
    FROM v
     UNION
    SELECT
        'Disk reads',
        disk_reads,
        sql_text,
        cpu_seconds,
        disk_reads,
        buffer_gets,
        executions,
        buffer_gets_rows_proc,
        buffer_gets_executions,
        elapsed_second,
        module
    FROM v
    ORDER BY order_by, order_val DESC
    
  • Select the data on the different data source

    Hello

    There is a Web Application of merger with a Module of the Application that is based on the "database server 1".

    For the calculation of the values of database 1, I need to get data (Table DB) '2 database server.

    How to get values (Table) database 2 in the same project?

    (I must have a second Module of Application maybee?)

    Thank you for advice.

    I suggest to have several app module with in your template project. Suppose appmod1 for "Database Server 1" and appmod2 for "database 2" server.
    I did the same thing in my application and it works very well.

    ~ Abhijit

  • SQL - select the data with the nearest past date

    Hello
    I have a requirement to retrieve data based on a closer effective_date in the past.
    Here are examples of data

    Data in the table

    DESCRIPTION OF ARTICLE EFFECTIVE_DATE
    ---------------------------------------------------------------------------
    018885237 24 OCTOBER 09 DVD + R 47 10 PK
    DISC OF DVD + R 10 018885237 16 APRIL 10

    040706113 FLASH PLAYER 24 OCTOBER 09
    040706113 4 March 10 Micro USB 4 GB
    040706113 13 January 10 Flash drive 4 GB

    032140640 26 FEBRUARY 10 8 GB USB
    032140640 24 OCTOBER 09 8 GB FLASH

    The power required

    DESCRIPTION OF ARTICLE EFFECTIVE_DATE
    ---------------------------------------------------------------------------
    DISC OF DVD + R 10 018885237 16 APRIL 10
    040706113 4 March 10 Micro USB 4 GB
    032140640 26 FEBRUARY 10 8 GB USB

    Can someone help me with the SQL please?

    Concerning
    Harsha
    SQL> --- generating sample  data:
    SQL> with t as (
      2  select 018885237 item, to_date('24-OCT-09', 'dd-mon-yy') effective_date, 'DVD+R 47 10 PK' description from dual unio
      3  select 018885237, to_date('16-APR-10', 'dd-mon-yy'), 'DVD+R 10 DISC' from dual union
      4  select 040706113, to_date('24-OCT-09', 'dd-mon-yy'), 'FLASH DRIVE' from dual union
      5  select 040706113, to_date('04-MAR-10', 'dd-mon-yy'), '4GB USB Micro' from dual union
      6  select 040706113, to_date('13-JAN-10', 'dd-mon-yy'), 'Flash Driv 4GB' from dual union
      7  select 032140640, to_date('26-FEB-10', 'dd-mon-yy'), '8GB USB' from dual union
      8  select 032140640, to_date('24-OCT-09', 'dd-mon-yy'), '8GB FLASH' from dual
      9  )
     10  --
     11  -- actual query
     12  --
     13  select  item
     14  ,      effective_date
     15  ,      description
     16  from ( select item
     17         ,      effective_date
     18         ,      description
     19         ,      row_number() over (partition by item order by effective_date desc)  rn
     20         from   t
     21       )
     22  where rn=1;
    
          ITEM EFFECTIVE DESCRIPTION
    ---------- --------- --------------
      18885237 16-APR-10 DVD+R 10 DISC
      32140640 26-FEB-10 8GB USB
      40706113 04-MAR-10 4GB USB Micro
    
  • Everytime I turn on my laptop, I get a warning that the Data Execution Prevention System has stopped working. Any ideas how to fix this, please?

    Running Windows Vista family - that's all as far as I know!

    Hi Norfolk broad,

    Remember to make changes?

    Method 1:  Put the computer to boot and then check if the problem persists

    Follow step 1 in the link below,

    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7

    If everything works well after a clean boot, you can deduce that some third-party services are at the origin of the problem.

    Continue with the remaining steps to pin-point on the third party service.
    After find you the program that is causing the problem, you will have to perhaps to update or install a newer version of the program, if you rarely use that you should consider uninstalling the software.

    Important: n ' forget not to put the computer to a normal startup follow step 7 in the link.


    Method 2:
    if a Protection of resources Windows (WRP) file is missing or is damaged, Windows may not behave as expected. Auditor of file system (CFS) scan to fix all of the corrupted system files. To do this, follow the steps mentioned in the link below:

    How to use the System File Checker tool to fix the system files missing or corrupted on Windows Vista or Windows 7

    http://support.Microsoft.com/kb/929833

    See the link below for more information on the execution prevention (DEP) data
    http://Windows.Microsoft.com/en-us/Windows-Vista/data-execution-prevention-frequently-asked-questions

Maybe you are looking for