query is refactoring difference?

Hi people

In the code below, is there an advantage to query refactoring quite a view inline?

Please enlighten us on this

Thank you very much

Oracle11g
SQL> select ename,job from
  2  (
  3  select e.ename,e.job,d.deptno
  4  from emp e, dept d
  5  where e.deptno=d.deptno)
  6  /

ENAME      JOB
---------- ---------
SMITH      CLERK
ALLEN      SALESMAN
WARD       SALESMAN
JONES      MANAGER
MARTIN     SALESMAN
BLAKE      MANAGER
CLARK      MANAGER
SCOTT      ANALYST
KING       PRESIDENT
TURNER     SALESMAN
ADAMS      CLERK
JAMES      CLERK
FORD       ANALYST
MILLER     CLERK

14 rows selected.

SQL> ed
Wrote file afiedt.buf

  1  with t as
  2  (
  3  select e.ename,e.job,d.deptno
  4  from emp e, dept d
  5  where e.deptno=d.deptno)
  6* select ename,job from t
SQL> /

ENAME      JOB
---------- ---------
SMITH      CLERK
ALLEN      SALESMAN
WARD       SALESMAN
JONES      MANAGER
MARTIN     SALESMAN
BLAKE      MANAGER
CLARK      MANAGER
SCOTT      ANALYST
KING       PRESIDENT
TURNER     SALESMAN
ADAMS      CLERK
JAMES      CLERK
FORD       ANALYST
MILLER     CLERK

14 rows selected.

SQL>

See: http://asktom.oracle.com/pls/apex/f?p=100:11:0:P11_QUESTION_ID:4423923392083

Tags: Database

Similar Questions

  • SQL Query search line differences

    Hi all!

    It will probably be a super easy question and a solution for someone.  Here's my scenario.

    • 2 tables (Table_1, Table_2)
    • 3 columns (A, B, C)
    • Table_1 unless Table_2 records, if I want to find records in Table_2 who aren't in Table_1
      • I don't like to find the records that are in Table_1 and Table_2
    • I'll do the comparison with column a.

    For simplicity, lets say a 10 lines total Table_1 and Table_2 15 total of lines.  He must only find 5 rows that are not in Table_1 and Table_2.  So, if I add the number of records found in Table_2 Table_1 total records, then I would have at least the same amount of records in Table_1 and Table_2, if not more.  Also, is there a way where I can insert the differences between the lines found in a 3rd table "to stop"?

    The example is provided below.

    Table_1

    A | B | C

    1. Bonneau | something

    2. Bonneau | something

    3. Bonneau | something

    4. Bonneau | something

    5. Bonneau | something

    Table_2

    A | B | C

    1. Bonneau | something

    3. Bonneau | something

    5. Bonneau | something

    6. Bonneau | something < = difference

    7. Bonneau | something < = difference

    In fact, there are millions of records in both tables.  I have a solution for this, but it would require me to do... Export results from Table_1 and Table_2.  Open the two results in Excel and run a macro to know the difference.  Once I found the difference, I save and import the results into the 3rd table 'intermediate '.

    Any help would be great!  Thank you!

    Hello

    You can use a subquery NOT EXISTS or NOT IN the for.

    For example, scott.dept and scott.emp are assimilated by deptno.  To find all the rows in the dept who do not have a corresponding row in the emp:

    SELECT *- or all of the columns that you want to

    OF scott.dept

    WHERE deptno NOT IN ((in English only)

    SELECT DeptNo

    FROM scott.emp

    WHERE deptno IS NOT NULL - if necessary

    )

    ;

    When you use a NOT IN subquery, check that the subquery cannot produce NULL values.

    I hope that answers your question.

    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.  Include an example where the column has is identical in the two tables, but columns B and C are not.

    Post your best attempt (use one of the solutions of publication) and specify where it's getting incorrect results, explain, using specific examples, how you get the right results from data provided in these places.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002

  • SQL query problem finding difference in documents

    Hi all
    I use oracle 10g. I need emergency aid to find the difference in documents based on the date:

    I have sales of the table as below:

    seller SALES_COUNT DATE
    JOHN 20 04/01/2012
    DENNY 15 04/01/2012
    JOHN 30 04/02/2012
    DENNY 30 04/02/2012
    JOHN 45 04/03/2012
    DENNY 50 04/03/2012


    SALES_COUNT is up to man including the date of sale. Its similar cumulative number. John has total sales of 01/04/2012 to 03/04/2012 is 50 and same case for Denny. This SALES_COUNT will keep increasing with dates as sales continue to add in the table for each salesperson.
    But I want to have seprate for each seller counties.
    for example: JOHN SALES_COUNT 04/02/2012 is 30-20 = 10
    JOHN SALES_COUNT 03/04/2012 is 45-30 = 15
    DENNY SALES_COUNT, 02/04/2012 is 30-15 = 15
    JOHN SALES_COUNT 03/04/2012 is 50-30 = 20

    Please help me with this scenario and let me know if you need clarification. I would much appreciate your help.

    Thank you.

    This gives you what you want?

    with t as (
         select 'JOHN' salesman, 20 sales_count, to_date('04/01/2012', 'mm/dd/yyyy') sale_date from dual
         union all
         select 'DENNY' salesman, 15 sales_count, to_date('04/01/2012', 'mm/dd/yyyy') sale_date from dual
         union all
         select 'JOHN' salesman, 30 sales_count, to_date('04/02/2012', 'mm/dd/yyyy') sale_date from dual
         union all
         select 'DENNY' salesman, 30 sales_count, to_date('04/02/2012', 'mm/dd/yyyy') sale_date from dual
         union all
         select 'JOHN' salesman, 45 sales_count, to_date('04/03/2012', 'mm/dd/yyyy') sale_date from dual
         union all
         select 'DENNY' salesman, 50 sales_count, to_date('04/03/2012', 'mm/dd/yyyy') sale_date from dual
    )
    select salesman,
           sales_count sales_todate,
           sale_date,
           sales_count - lag(sales_count, 1, 0) over (partition by salesman order by sale_date) daily_sales
    from t
    
    SALESMAN,SALES_TODATE,SALE_DATE,DAILY_SALES
    DENNY,15,4/1/2012,15
    DENNY,30,4/2/2012,15
    DENNY,50,4/3/2012,20
    JOHN,20,4/1/2012,20
    JOHN,30,4/2/2012,10
    JOHN,45,4/3/2012,15
          
    
  • I use the same query in two difference db (exp/imp) but run different times!

    Hello

    I have 2 database. One of the remote server, one at my local. I used exp/imp to retrieve data from remote to my local database. Structers, tables and indexes is the same.
    My local machine is more powerful than the remote computer. (Ram, cpu County ext)

    But when I connect remotely from my local computer, this application runs 4 second (with view). But when I connect to my local db, this query run 5 minutes.
    Number of rows returned is 18,500

    What's wrong? Why get the bytes of the value are different?

    Local explain plan is:
    SELECT STATEMENT ALL_ROWS Cost: 203 Bytes: 19,062,160 Cardinality: 18,329                                         
    Remote control explain plan is:
    SELECT STATEMENT ALL_ROWS Cost: 226 Bytes: 3,855,214 Cardinality: 18,446                                         
    My plans to explain (remote and the) and other (auto track, oracle params) data is in excel file (because of this forum not to accept more than 30,000 words);

    http://www.eksicevap.com/tech/explainplan.xls
    for winrar:
    http://www.eksicevap.com/tech/explainplan.rar

    Thanks for help

    Oracel version information:
    Local:
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
    Distance:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi

    Published by: Melike on 15.Mar.2011 02:42

    Published by: Melike on 15.Mar.2011 03:39

    Melike says:
    Thanks, Johan, I'll try.
    My first post for local oracle param, I got it 3 days ago. or I confuse my file params to oracle. (This problem continues from last week)
    Now I'm waiting still current oracle local params and these value is worse:

    Local:
    pga_aggregate_target 0
    SGA_MAX_SIZE 536.870.912
    SGA_TARGET 0

    I update the new oracle local params in my previous message.

    I'll try the update of these values, but I hope, my local oracle is not drop down :)

    Can't be worse...
    You have a parameter memory_target (and max_memory_target)? If so, you could add memory to these settings as well and only set pga_aggregate_target (no CMS or sga_max)

    My settings (on a test/dev/lab-box):
    System@oracle11 SQL > see the memory settings

    VALUE OF TYPE NAME
    ------------------------------------ ----------- ------------------------------
    hi_shared_memory_address integer 0
    whole big memory_max_target 3G
    whole large memory_target 3G
    shared_memory_address integer 0
    System@oracle11 SQL > show parameter sga

    VALUE OF TYPE NAME
    ------------------------------------ ----------- ------------------------------
    lock_sga boolean FALSE
    PRE_PAGE_SGA boolean FALSE
    SGA_MAX_SIZE large integer 0
    SGA_TARGET large integer 0
    System@oracle11 SQL > show parameter pga

    VALUE OF TYPE NAME
    ------------------------------------ ----------- ------------------------------
    pga_aggregate_target large integer 0

    This way I pushed things like Oracle by itself, memory allocation to everywhere where oracle needs him the most.

    Brgds
    Johan

  • Difference of timestamp in the same column

    Question for Oracle guru. I have a DB (Oracle) table as below

    ID STATUS TIMESTAMP

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

    1  NEW   30-JAN-15 08.11.11.803384000 PM 

    2  NEW   30-JAN-15 08.11.13.606681000 PM

    1  COMPLETED   30-JAN-15 08.11.15.997794000 PM

    2  COMPLETED   30-JAN-15 08.11.16.469299000 PM

    I want to do 2 things

    1. Query for Timestamp difference for each id from status new to complete

    2. Query for Avg time between new to complete for all id's between new to complete

    Can you help me with a better way to do this

    create table ts_test(
      id number,
      status varchar2(20),
      ts timestamp(9)
    )
    ;
    insert into ts_test values (1, 'NEW', localtimestamp);
    insert into ts_test values (1, 'COMPLETED', localtimestamp);
    insert into ts_test values (2, 'NEW', localtimestamp);
    insert into ts_test values (2, 'COMPLETED', localtimestamp);
    insert into ts_test values (3, 'NEW', localtimestamp);
    insert into ts_test values (3, 'COMPLETED', localtimestamp);
    
    with elapsed_intervals as (
      select
        id,
        status,
        ts,
        ts - lag(ts) over (partition by id order by ts) id_elapsep_interval
      from ts_test
    )
    select
      id,
      status,
      ts,
      id_elapsep_interval,
      round(avg((sysdate + id_elapsep_interval * 24 * 60 * 60 - sysdate)) over (order by null), 1) avg_elapsed_interval
    from elapsed_intervals
    order by id
    ;
    
    1 rows inserted.
    1 rows inserted.
    1 rows inserted.
    1 rows inserted.
    1 rows inserted.
    1 rows inserted.
            ID STATUS               TS                            ID_ELAPSEP_INTERVAL AVG_ELAPSED_INTERVAL
    ---------- -------------------- ----------------------------- ------------------- --------------------
             1 NEW                  03.02.2015 00:28:09,873000000                                      2,8
             1 COMPLETED            03.02.2015 00:28:12,897000000 0 0:0:3.024                          2,8
             2 NEW                  03.02.2015 00:28:16,472000000                                      2,8
             2 COMPLETED            03.02.2015 00:28:19,623000000 0 0:0:3.151                          2,8
             3 NEW                  03.02.2015 00:28:22,156000000                                      2,8
             3 COMPLETED            03.02.2015 00:28:24,442000000 0 0:0:2.286                          2,8 
    
     6 rows selected
    
  • difference of 2 queries

    Will be the following query returns the difference of the column "sum (e.gl_fig)" by the two queries?


    Select (select sum (e.gl_fig) in the rm_gl e where e.as_on_dt < = trunc (to_date('30-NOV-2011'), 'Q')-1)-(select sum (e.gl_fig) in the e rm_gl where e.gl_id in (211,212,213,214,215,216,217) and e.as_on_dt = to_date('30-NOV-2011')) current_quarter_amount of the double

    Have you tried? Doing a job?

    Looks like it should probably work, but not easy to read ;-)

    (Would be nice if you put in the code and put it to the breast

     tags...)                                                                                                                                                                                                                                                                                                                                                                        
    
  • Different ways to write an external application

    Hello

    I hope that someone has already found an answer on the following question related outer joins

    It is written in the Oracle documentation that

    >

    If A and B are joined by multiple join conditions, you must use the sign (+) operator in all these conditions. If you do not, Oracle database will return only the rows resulting from a join simple, and without a warning or error you inform that you have not results > an outer join.

    Could someone give an example of a SQL query demonstrating this difference in the final results?

    I tried to simulate multiple join conditions with the LEFT [ OUTER ] JOIN syntax as well as( + ) syntax, but got the same shots of performances and results.

    Hello

    e71159e8-9c29-40Cf-8119-7fa9acca37bf wrote:

    Thank you!

    Could you please specify where you read this information:

    This is true for versions prior to 11g.

    Since I read "If A and B are joined by multiple join conditions, you must use the (+) operator in all of these conditions. sign ' in Oracle 11 g Documentation.

    Nothing on this issue changed in Oracle 11.

    ANSI join syntax (for example FROM dept LEFT OUTER JOIN emp ON...) was introduced in Oracle 9.1 and works exactly the same in all versions.

    You never have to use the (+) sign operator if you use the ANSI rating.  If someone tells you "you must use the (+) sign operator", of course, they mean "on the use of older join notation" (which works in all versions of Oracle).  If the sign (+) operator is applied to a column of the emp table in a condition, then all of the conditions involving any column of emp must have a (+) operator, otherwise the effect will be the same as an inner join.

  • Join CPC IKM (null) problem

    Hi all
    I ve a SCD table. This table contains information of people and people id is PK. When the information of a person changes, new line is inserted and the current flag is updated. But I have a problem with null columns.
    My query checks the difference between source and target colums, it cannot match the null columns. I can solve this problem NVL but I d like to add null null my target table columns columns.

    I use the sub expression to search for a line has changed.



    and NOT EXISTS)
    Select 'x '.
    < % = odiRef.getTable ("L", "TARG_NAME", "A") % > T
    where < %=odiRef.getColList ("","t. [column] \t= [EXPRESSION]", "\n\tand\t", "", "SCD_NK") % >
    < %=odiRef.getColList ("and\t", "(([EXPRESSION] = t. [COL_NAME]))", "\n\t\tand\t", "", "((SCD_UPD OR SCD_INS) AND REW) AND!" ") TRG AND! SCD_NK") % >
    < %=odiRef.getColList ("and\t", "\t= 1","\nand\t","","SCD_FLAG")% [column] > ")
    < %=odiRef.getColList ("and\t", "[column] \t= to_date ('01 - 01-2400', ' mm-dd-yyyy')","\nand\t","","SCD_END")% >) ")
    )


    How can I convert all nvl and char data types in this expression to a match between the columns.
    (IE nvl (to_char (targetcolumn1), '-1') = nvl (to_char (sourcecolumn1), '-1'))


    All the expression:


    Insert / * + APPEND * / into < % = odiRef.getTable ("L", "INT_NAME", "A") % >
    (
    < % = odiRef.getColList ("", "[column] ',' \n\tclick ', ','" (((SCD_NK ou SCD_INS ou SCD_UPD) and!)) "") TRG))') % >
    < % = odiRef.getColList ("", "[column] ',' \n\tclick ', ',',"(SCD_START)"") % >
    IND_UPDATE
    )
    < % / * QUERY WITHOUT GROUPBY * / if (odiRef.getGrpBy () .length () == 0) {% >}
    Select < % = odiRef.getOption ("OPTIMIZER_HINT") % > < % = odiRef.getPop ("DISTINCT_ROWS") % >
    < % = odiRef.getColList ("", "[EXPRESSION] ',' \n\tclick ', ','" (((SCD_NK ou SCD_INS ou SCD_UPD) and!)) "") TRG))') % >
    < % if (odiRef.getColList ("", "D", "", "", "(SCD_START)" "). length()!) = 0) {}
    If (odiRef.getColList ("", "[EXPRESSION] ',' \n\tclick ', ',', '(SCD_START)'"). length()!) = 0) {}
    out. Print (odiRef.getColList ("", "[EXPRESSION] ',' \n\tclick ', ',',"(SCD_START)""));
    } else {}
    out. Print (odiRef.getColList ("", "sysdate ',' \n\tclick ', ',',"(SCD_START)""));
    }
    } % >
    < % if (odiRef.getPop("HAS_JRN").equals("0")) {% >}
    'I' IND_UPDATE
    < %} else {% >}
    JRN_FLAG
    < %} % >
    < % = odiRef.getFrom () % >
    where (1 = 1)
    < % = odiRef.getJoin () % >
    < % = odiRef.getFilter () % >
    < % = odiRef.getJrnFilter () % >
    and NOT EXISTS)
    Select 'x '.
    < % = odiRef.getTable ("L", "TARG_NAME", "A") % > T
    where < %=odiRef.getColList ("","t. [column] \t= [EXPRESSION]", "\n\tand\t", "", "SCD_NK") % >
    < %=odiRef.getColList ("and\t", "(([EXPRESSION] = t. [COL_NAME]))", "\n\t\tand\t", "", "((SCD_UPD OR SCD_INS) AND REW) AND!" ") TRG AND! SCD_NK") % >
    < %=odiRef.getColList ("and\t", "\t= 1","\nand\t","","SCD_FLAG")% [column] > ")
    < %=odiRef.getColList ("and\t", "[column] \t= to_date ('01 - 01-2400', ' mm-dd-yyyy')","\nand\t","","SCD_END")% >) ")
    )
    < %}; % >
    < % / * If GROUPBY IS USED (s) * / if (odiRef.getGrpBy () .length () > 0) {% >}
    Select *.
    de)
    Select < % = odiRef.getOption ("OPTIMIZER_HINT") % > < % = odiRef.getPop ("DISTINCT_ROWS") % >
    < % = odiRef.getColList ("", "[EXPRESSION] ',' \n\tclick ', ','" (((SCD_NK ou SCD_INS ou SCD_UPD) and!)) "") ("(TRG) and REW)") % >
    < % if (odiRef.getColList ("", "D", "", "", "(SCD_START and REW)" ") .length ()! = 0) {}
    If (odiRef.getColList ("", "[EXPRESSION] ',' \n\tclick", ",", "(SCD_START and REW)" ") .length ()! = 0) {}
    out. Print (odiRef.getColList ("", "[EXPRESSION] ',' \n\tclick ', ',',"(SCD_START et REW) '));
    } else {}
    out. Print (odiRef.getColList ("", "sysdate ',' \n\tclick ', ',',"(SCD_START et REW) '));
    }
    } % >
    < % if (odiRef.getPop("HAS_JRN").equals("0")) {% >}
    'I' IND_UPDATE
    < %} else {% >}
    JRN_FLAG
    < %} % >
    < % = odiRef.getFrom () % >
    where (1 = 1)
    < % = odiRef.getJoin () % >
    < % = odiRef.getFilter () % >
    < % = odiRef.getJrnFilter () % >
    < % = odiRef.getGrpBy () % >
    < % = odiRef.getHaving () % >
    ) S
    where does NOT EXIST)
    Select 'x '.
    < % = odiRef.getTable ("L", "TARG_NAME", "A") % > T
    where < %=odiRef.getColList ("","t. [column] \t= [EXPRESSION]", "\n\tand\t", "", "SCD_NK") % >
    < %=odiRef.getColList ("and\t", "(([EXPRESSION] = t. [COL_NAME]))", "\n\t\tand\t", "", "((SCD_UPD OR SCD_INS) AND REW) AND!" ") TRG AND! SCD_NK") % >
    < %=odiRef.getColList ("and\t", "\t= 1","\nand\t","","SCD_FLAG")% [column] > ")
    < %=odiRef.getColList ("and\t", "[column] \t= to_date ('01 - 01-2400', ' mm-dd-yyyy')","\nand\t","","SCD_END")% >) ")
    )
    < %}; % >


    THX.

    >

    How can I convert all nvl and char data types in this expression to a match between the columns.
    (IE nvl (to_char (targetcolumn1), '-1') = nvl (to_char (sourcecolumn1), '-1'))

    Just wrap a Column / EXPRESSION strands according to your example in your message:
    Like this:

    where< %="odiRef.getColList" ("nvl="" «, »="" (to_char="" (t.="" [column]),="" « x »)="" \t="nvl(to_char([EXPRESSION]),'x') »," « \n\tand\t »,="" « »,="" « scd_nk »)="" %="">

    continue for the rest of the where clause.

  • cfform/cfgrid form submit error

    I have a simple grid:

    < name cfgrid = format "testGrid" = 'flash' query = "getHistory" >
    < name cfgridcolumn = "idno" header = "Employee ID" >
    < / controls cfgrid >

    The grid is filled very well. When I send the form to the place to see the form variables, I get the following error:

    The cfgrid submitted form field is corrupted (name: value __CFGRID__NEWFORM__TESTGRID: __CFGRID__COLUMN__CFGRIDROWINDEX __CFGRID__DATA__1__CFGRID__COLUMN__IDNO__CFGRID__DATA__3000080)

    I changed the columns in the query and no difference. The error still occurs.
    Any ideas on the origin of this error?
    We are using CFMX 7.02 on Windows 2000 Server. Request is coming from Oracle 8i.
    Thank you.

    Mark

    I found the problem. I called a tag in application.cfm. It is a CF5 upgraded application.

    Apparently, it breaks validation of a Flash form action. I removed the code and now life is still good.

    Mark

  • Eloqua reporting: what is the difference between 'Link clicks' and 'interactive generated query string value "?

    clicks.png

    Sometimes, I need to look at the link clicks in order to determine what link they clicked and sometimes the value of query string. What is the difference?

    Redirect link is the actual URL that redirects to a specific Web site location.

    Value of query string of clicks is what follows after the "?" in the link. These query strings do not change the location where the user is directed to but is for information purposes.

    If you were to combine interactive generated link and the value of clicks query string, you will get the full link following the user.

    Example: In your screenshot, for the first row in the report, the user would have followed this link:

    https://play.Google.com/store/apps/details?ID=no.osloby.app

    The report broke it into 2 parts: clicks link (https://play.google.com/store/apps/details) and the value of query string of clicks (? id = no.osloby.app).

    You can create custom query strings under configuration > site: query strings. This can be useful if you want to create your own way to mark up and view metrics on clicks for links. When you define a query string parameter, you can add this setting with different values at the end of the links to follow only those (ex: "?") QueryStringParam = value1'). I used this is to differentiate between separate instances of identical links in the same email (ex: a link is a banner image and text) to see who is the most useful and results in the most traffic. You can then view a breakdown of clicks by each query string under Insight > reports and dashboards > site > overview of Query String parameters.

    Hope this helps... Let me know if you have any other questions.

  • A design of query for the conversion of time difference in days, hours, Minutes

    Hi all

    A design of query for the conversion of time difference of time in number of days remaining remaining hours minutes and rest in seconds. Made this one till now. Please suggest for all modifications, until now, it seems to work very well, kindly highlight for any anomaly.

    WITH DATA (startDAte, EndDate, Datediff) AS (SELECT to_date ('2015-10-01 10:00:59 ',' yyyy-mm-dd hh24:mi:ss'), to_date ('2015-20-01 03:00:49 ',' yyyy-mm-dd hh24:mi:ss'), to_date('2015-10-01 10:00','yyyy-dd-mm hh24:mi:ss')-to_date('2015-20-01 03:00','yyyy-dd-mm hh24:mi:ss') FROM dual)

    UNION ALL SELECT to_date ('2015-10-01 10:00:39 ',' yyyy-mm-dd hh24:mi:ss'), to_date ('2015-20-01 03:00:40 ',' yyyy-mm-dd hh24:mi:ss'), to_date('2015-10-01 10:00','yyyy-dd-mm hh24:mi:ss')-to_date('2015-20-01 03:00','yyyy-dd-mm hh24:mi:ss') FROM dual

    UNION ALL SELECT to_date ('2015-11-01 10:30:45 ',' yyyy-mm-dd hh24:mi:ss'), to_date ('2015-11-01 11:00:50 ',' yyyy-mm-dd hh24:mi:ss'), to_date('2015-11-01 10:30','yyyy-dd-mm hh24:mi:ss')-to_date ('2015-11-01 11:00 ',' yyyy-mm-dd hh24:mi:ss') FROM dual

    UNION ALL SELECT to_date ('2015-11-01 09:00:50 ',' yyyy-mm-dd hh24:mi:ss'), to_date ('2015-11-01 10:00:59 ',' yyyy-mm-dd hh24:mi:ss'), to_date('2015-11-01 09:00','yyyy-dd-mm hh24:mi:ss')-to_date ('2015-11-01 10:00 ',' yyyy-mm-dd hh24:mi:ss') FROM dual

    UNION ALL SELECT to_date ('2015-11-01 08:30:49 ',' yyyy-mm-dd hh24:mi:ss'), to_date ('2015-11-01 09:30:59 ',' yyyy-mm-dd hh24:mi:ss'), to_date('2015-11-01 08:30','yyyy-dd-mm hh24:mi:ss')-to_date('2015-11-01 09:30','yyyy-dd-mm hh24:mi:ss') FROM dual

    )

    Select

    trunc ((EndDate-StartDate)) days.

    trunc (((enddate-startdate)-to_number (trunc ((enddate-startdate))) * 24) hours)

    trunc (to_number (((enddate-startdate)-to_number (trunc ((enddate-startdate))) * 24-trunc (((enddate-startdate)-to_number (trunc ((enddate-startdate))) * 24)) * 60) Minutes,))

    (to_number (((enddate-startdate)-to_number (trunc ((enddate-startdate))) * 24-trunc (((enddate-startdate)-to_number (trunc ((enddate-startdate))) * 24)) * 60 - trunc (to_number (((enddate-startdate)-to_number (trunc ((enddate-startdate))) * 24-trunc (((enddate-startdate)-to_number (trunc ((enddate-startdate))) * 24)) * 60)) * 60 seconds))))

    data;

    Thanks for the answers in advance.

    AHA!

    TO_TIMESTAMP expects a string as input, so it first makes an implicit conversion from DATE to a string, in the format of NSL_DATE_FORMAT.

    To convert the TIMESTAMP DATE independently NLS_DATE_FORMAT, use

    CAST ( AS TIMESTAMP)

  • Hi I am new to Oracle forms and reports I want to know the differences between the Enter query mode and Normal mode?

    Hi I am new to Oracle forms and reports I want to know the differences between the Enter query mode and Normal mode?

    Welcome to Oracle Forms!  Out of curiosity, what do you mean by 'new '?  You are a student or new to an organization that uses Oracle Forms?  Or just play with Oracle Forms to learn something new?

    Let me start by saying that many of your questions designtime can answer by searching in the help of the constructor of the form library.  It's accessible, like most of the other products in the Builder menu > help.

    Regarding your question, ENTER QUERY mode, as the term implies, is when it is in a State where it is accept input for the execution of a query.  When in this mode, there are various restrictions.  Yet once, it will find more details in the Builder Help.  In this case, search help for these two subjects, "SYSTEM." MODE'and "built-ins comments that are not allowed in the input query Mode".  There are many other pages that contain information about the ENTER_QUERY method, but these two should help you get started.

    Normal mode, as its name implies, is when it is in a State of 'normal '.  Basically to do nothing in particular, but also not in ENTER QUERY mode.  In this State, you can move the shape, INSERT, UPDATE, DELETE, documents, etc..

    You will find additional information, as well as a lot of documentation on the product page of forms of OTN:

    http://www.Oracle.com/technetwork/developer-tools/forms

  • Need help with query Cumulative difference

    Hi all

    I need help with a query and my requirement is as below

    {code}

    ROWNOORDERSVALUE

    110900
    211700
    312500
    413400

    {/ code}

    I have need to query which will display the cumulative difference for example I value tell 10000 numbers opening

    now I need for each of the lines of cumulative difference

    {code}

    ROWNO ORDERS DIFF

    1 10 10000 - 900 = 9100

    2 11 9100 - 700 = 8400

    3 12 8400 - 500 = 7900

    4 13 7900 - 400 = 7500

    {/ code}

    WITH commands LIKE (10 SELECT order_id, 900 double UNION ALL val
    11. SELECT, 700 FROM dual UNION ALL
    SELECT 12, 500 FROM dual UNION ALL
    Select 13, 400 double)

    SELECT row_number() over (ORDER BY order_id ASC) AS rowno
    order_id
    sum (val) 10000 - OVER (ORDER BY order_id ASC) AS diff
    orders

    /

    HTH

  • Hola! no self if alguien quiera Yes a bit of Asesoría, are as bastante confundido estoy... Queria long!  the difference existing between el PHOTOSHOP CC led package of FOTOGRAFIA y APPLICATION UNICA? that difference between ellos hay? are the same app

    Hola! no self if alguien quiera Yes a bit of Asesoría, are as bastante confundido estoy... Queria long!  the difference existing between el PHOTOSHOP CC led package of FOTOGRAFIA y APPLICATION UNICA? that difference between ellos hay? are the same cc photoshop application? because is offers mas barata in el FOTOGRAFIA package?

    photoshop and lightroom in the Pack of photographers are 100% identical as individual photoshop and lightroom different subscriptions (for much less cost).

    So yes, it is foolish to subscribe to only one photoshop or lightroom.  even if you're only going to use one of them, you should subscribe to the plan of photographers.

  • Query to get the difference between 2 totals of 2 different queries

    I wanted to know if it is possible to get the difference between 2 totals of 2 different queries. Let me explain with an example:

    1 application ofst - sum (homepass) Select table 1

    2th query: select sum (homepass) from table2

    Is it possible to display the difference as -

    Select sum (homepass) in table 1 - sum (homepass) from table2

    I know that the above query would give syntax error, but is there a better way or something to get the above done task from a single query.


    Hopefully, my question is clear.


    Please get back with the answer to my query.


    Concerning

    You can always do something like

    SELECT a.cnt - b.cnt
    FROM (SELECT sum(homepass) cnt from table1) a,
          (SELECT sum(homepass) cnt from table2) b
    

    I'd be somewhat dubious, although on a data model that had two tables with the same name of the column where it really made sense to subtract one amount from each other.  This would strongly imply that there should be a single table with an additional column TYPE eventually.

    Justin

Maybe you are looking for

  • How can I tell Firefox to clear the list of files uploaded to the exit?

    When I was using Firefox 3.x, I configured it to clear the list of files uploaded to the exit. Now, I 'upgraded' to Firefox 7.0.1 and it ceased to do so. Not only that, he doesn't seem to be a way to get this feature. Y at - it a setting that I misse

  • Portege M400: update XP to Vista causes the page fault in nonpaged area

    I spent several hours working through the Vista upgrade only. After a restart the process, I get a BSOD now reporting a page fault. Microsofts advice was to regularize the upgrade and then try again. Useful (or not) This resulted in the same second t

  • tactile façade

    Hi all! I am new to the development complex applciation in labview and I want to ask if a normal façade can be used by a screen touch monitor o I need to develop an appropriate code to achieve this funcioton. I saw that there is a Toolbox for this (t

  • Variant of data object class

    The 'variant data' has 'Type' is a required entry, according to the help documentation. However, I can make a Variant to the data without the help of the type when the variant is an object and a class method is fixed. Is this expected behavior? A scr

  • Media Player 11 does not recognize the iPod nano

    I have Media Player 9 installed on my Windows XP computer. It didn't recognize my iPod Nano. I downloaded MP 11 - still, there is no recognized my Nano. I don't see an ' Add' button when I click on Tools_Options_Devices, so I can't understand how to