1......100 from dual

Hi,
How to print 1..100 using dual table in a SQL statement(no pl/sql) ?
Regards
gopureddi

I should have added this works only in 10g :
SQL> select level from dual connect by level <= 100;
LEVEL
1
2
3
4
5
6
7
8
9
10
11
in 9i :
SQL> select level from dual connect by level <= 100;
LEVEL
1

Similar Messages

  • How to generate multiple records on a single sql from dual table

    I wanted to generate ten sequence nos in a single sql statement from dual table.
    Is there any way to use that.
    I think somebody can help me on this by using level clause

    I'm not 100% sure if I understand your requirement: Do you really want to use an Oracle Sequence, as Alex already demonstrated?
    Or just a 'one-time-bunch-of-sequential-numbers'.
    In the latter case you can just select level:
    SQL> select level
      2  from   dual
      3  connect by level <= 10;
         LEVEL
             1
             2
             3
             4
             5
             6
             7
             8
             9
            10
    10 rows selected.

  • Select sysdate from dual, why?

    I have been looking at the SQL that is generated during fetches, updates
    etc. Why is the SELECT SYSDATE FROM DUAL being executed prior to every sql
    statement being executed?
    If I had to guess I would say it has to do with locking or logging but
    don't really have a clue!
    I suppose the final question is ... how can I switch it off!
    Thanks in advance
    Matt

    Have not seen oracle just dropping connection. In any case if you are using
    oracle JDBC 2 it has error event which lets you handle error conditions plus
    PooledConnection.getConnection() raises exception if its underlying physical
    connection is dead so you can catch it and discard old PooledConnection (and
    do not return it to the pool) and create new one without error ever going to
    the user. No need for "select sysdate from dual" once in a while or god
    forbid on every getConnection() /* hope oracle handles it more efficiently
    */ I stress tested my pool implementation - running many threads on JDO
    reads and killing connections on server left and right and Kodo never saw
    killed connections - it all was handled within pool itself without anything
    like "select sysdate from dual". What I am trying to say is at least as far
    as Oracle JDBC concerned their PooledConnection takes care of this
    "Patrick Linskey" <[email protected]> wrote in message
    news:[email protected]...
    Matt,
    We issue this to validate that connections retrieved from the pool are,
    in fact, open. Oracle has a nasty habit of dropping connections (you'd
    be surprised with some of the ways that Oracle sucks...), so it tends
    to be good to do this check relatively frequently.
    The frequency at which it occurs depends on a number of factors. First,
    it depends on whether or not you are using a connection pool. I believe
    that if you do not use the conn pool, then we probably check every time
    you get a connection. Second, it depends on the setting of the
    com.solarmetric.kodo.impl.jdbc.ConnectionTestTimeout setting, which
    specifies how often to check connections for validity. I believe that
    it's a number in seconds, but I'm not 100% sure; the configuration
    section of our docs will have the right answer. Third, it depends on
    the setting of com.solarmetric.kodo.impl.jdbc.ConnectionRetainMode,
    which controls when we get connections and when we release them.
    Finally, you can turn it off altogether by setting the
    com.solarmetric.kodo.impl.jdbc.DBDictionaryProperties property to
    contain the string 'ValidateConnections=false', which will turn off
    connection validation altogether.
    -Patrick
    Patrick Linskey
    SolarMetric Inc.

  • Strange "select level from dual connect by level :N" behavior

    Oracle SQL Deveoper version:1.1.0.23
    Oracle database server version:
    select * from v$version;
    Oracle9i Enterprise Edition Release 9.2.0.7.0 - Production
    PL/SQL Release 9.2.0.7.0 - Production
    "CORE     9.2.0.7.0     Production"
    TNS for 32-bit Windows: Version 9.2.0.7.0 - Production
    NLSRTL Version 9.2.0.7.0 - Production
    Run the following queries in sequence as a script and look at number of rows returned:
    select 1, level l from dual connect by level < 1;
    select 2, level l from dual connect by level < 2;
    select 3, level l from dual connect by level < 3;
    select 4, level l from dual connect by level < 4;
    select 5, level l from dual connect by level < 5;
    select 6, level l from dual connect by level < 6;
    select 7, level l from dual connect by level < 7;
    select 8, level l from dual connect by level < 8;
    select 9, level l from dual connect by level < 9;
    select 10, level l from dual connect by level < 10;
    select 11, level l from dual connect by level < 11;
    select 12, level l from dual connect by level < 12;
    1 L
    1 1
    1 rows selected
    2 L
    2 1
    1 rows selected
    3 L
    3 1
    3 2
    2 rows selected
    4 L
    4 1
    4 2
    4 3
    3 rows selected
    5 L
    5 1
    5 2
    5 3
    5 4
    4 rows selected
    6 L
    6 1
    6 2
    6 3
    6 4
    6 5
    5 rows selected
    7 L
    7 1
    7 2
    7 3
    7 4
    7 5
    7 6
    6 rows selected
    8 L
    8 1
    8 2
    8 3
    8 4
    8 5
    8 6
    8 7
    7 rows selected
    9 L
    9 1
    9 2
    9 3
    9 4
    9 5
    9 6
    9 7
    9 8
    8 rows selected
    10 L
    10 1
    10 2
    10 3
    10 4
    10 5
    10 6
    10 7
    10 8
    10 9
    9 rows selected
    11 L
    11 1
    11 2
    11 3
    11 4
    11 5
    11 6
    11 7
    11 8
    11 9
    11 10
    10 rows selected
    12 L
    12 1
    12 2
    12 3
    12 4
    12 5
    12 6
    12 7
    12 8
    12 9
    12 10
    10 rows selected
    1000 L
    1000 1
    1000 2
    1000 3
    1000 4
    1000 5
    1000 6
    1000 7
    1000 8
    1000 9
    1000 10
    10 rows selected
    -- wrong result. return 1 row, should return 0 row
    -- May have some automagical code saw dual and return 1 row.
    select 1, level l from dual connect by level < 1;
    -- wrong result. Should return 11 rows, but it stopped at 10 rows.
    select 12, level l from dual connect by level < 12;
    select 1000, level from dual connect by level < 1000;

    ""By default, when Oracle JDBC executes a query, it receives the result set 10 rows at a time from the database cursor.""
    Sql dev overrides the default and fetches 50 (1.0) or 100 (1.1) rows at a time. In 1.1 this is configurable.
    "I don't HATE any SQL, as long as it's valid."
    That statement is absurd. So, if someone tells you a way to write your query that it allows it to run faster, you wouldn't care? You should hate some SQL, some of it is pure crap and needs to be rewritten. This is what we call 'junk code'. As a developer, your goal should be to write maintainable code. In short, if you have the choice between something that looks fancy and something that is legible and maintainable, choose the maintainability. Sorry, but if I ever saw that statement in a code review I would have made you rewrite it. Also, anything that runs differently on different databases should be avoided, its that simple.

  • Mutating Problem when insert  while selecting data from dual

    Hi All,
    we have a table
    test (
    ID NUMBER
    NAME VARCHAR2(100)) and a before insert trigger
    create or replace trigger test1
    before insert on test
    for each row
    begin
    select decode(max(id),null,1,max(id)+1) into :new.id from test;
    end;
    i am able to insert values by using
    "insert into test(name) values('test1')" with out any issues.
    when i am inserting the values
    "insert into test(name) select 'test1' from dual" i am getting error
    ORA-04091: table SCOTT.TEST is mutating, trigger/function may not see it
    Could someone please advice why i am getting error in second scenario.
    Thanks in Advance
    Prasad

    Prasad
    try
    insert into test (name) values ((select 'test1' from dual));
    Frank

  • Parallel invokation of illustrator from dual core machine.

    We have been using CS3 for long time. The demand of the utility (which uses illustrator)  has been increased a lot. As result we have run multiple illustrators at the same time (parallel) from dual core Windows 2033 server. We are unable to find a suitable example to do this task. It will be really helpful if anyone can provide help in this regard.
    Similarly currently illustrator popping-up illustrator while creating the image. Is there any option to stop popping-up illustrator on the screen while creating the image. I know we have a command for adobe normalize while converting post script file to PDF.
    Thanks in advance.
    Regards,
    Bhasya.

    Adobe desktop products are unsupported on server operating systems, so you are 100% on your own on this one, even more so for a legacy product liek CS3. That aside, there is no way to run multiple instances of AI at the same tiem other than through virtualization, but even then you still have to deal with the technical and legal aspects of licensing....
    Mylenium

  • Yoga 3 Pro or Yoga 2 Pro? Opinions from dual owners please

    Hi,
    I'm tossing up between the Yoga 2 Pro and the Yoga 3 Pro.
    I like the design of the 3 very much, and the weight.
    I will run Ofiice apps, Photoshop CS6 on the road, and lightroom 5.7.
    Any pros and cons from dual users with experience of this software in daily use would be apprecited.
    Regards,
    David.

    I will be doing a video review on my experience soon but here are some points I can tell you already -
    1) It is a great travelling companion, movies, videos, songs, small gaming is all perfect.
    2) Battery life is really nice, I watched 3.5 hour long Lord of the rings and still had about 60% left
    3) Pretty light and rotates 360 degrees, very comfortable to use in any and every mode.
    4) Does not get hot, remains cool.
    5) Exquisite looks especially the Bright orange color, which is my fav.
    6) Screen is beautiful and everything is crisp (I use it at 1080p)
    7) Some apps are very useful like ShareIt, transfer data from android, iphone etc in seconds over a wifi network.
    8) Performance is good for browsing as well.
    9) Boots in 3-5 seconds
    10) Keyoard is backlit and very nice but shallow, trackpad is an absolute delight.
    2 finger taps, 2 finger swipes, 3 finger swipes, 2 finger zoom, 2 finger scrolling of pages, everything is smooth and responsive.
    11) Sound quality is awesome as well, very loud and clear. Enough bass to provide enjoyable experience.
    What you should not expect -
    1) Heavy graphics intensive tasks.
    2) Lags a bit on some web pages scrolling (NOT noticeable)
    3) Some software which are useless and can be uninstalled.
    I typed this whole post on my Yoga 3 Pro and it is a great for me to type on this beauty.
    Going to watch a movie now.
    Current System - Lenovo Y510P, GT755M SLI, 8GB RAM, 1TB HDD + 24GB SSD
    When your plans fail, your Real Story begins!!

  • Display a column with a list of values from DUAL;

    Hello, how can I display something like:
    COL1
    A
    B
    C
    D
    E
    F

    On my planet these are 'words' ;) :
    SQL> select dbms_random.string('a', level)
      2  from   dual
      3  connect by level <= 10;
    DBMS_RANDOM.STRING('A',LEVEL)
    r
    BB
    pmE
    bHri
    aZZDC
    FzOZBf
    fXfPyIP
    LOqrQbnK
    AYzNgHcGc
    lvxRvflHXj
    10 rows selected.
    SQL> select dbms_random.string('a', dbms_random.value(10, 50))
      2  from   dual
      3  connect by level <= 10;
    DBMS_RANDOM.STRING('A',DBMS_RANDOM.VALUE(10,50))
    AKExSSzIJOkabCT
    VCHHRTcgtnBSlZyRmsITqzWqVNgDnPdnxmt
    qLnuyGQErxZvHttRBpWrPoLEiGUra
    rcllLkyZXiwvlcGaUoEAeMbEdZSHlZBIgdilgGTQzxlIUW
    ftnGzDCzUBEsxKzhDLfgS
    aqUmpIzjqkWMZGpbAchhbiqFBUKdRaDwFAgdP
    nskqNdzmlAKlsGOJpbKfQHiCfvkDpoFcTkTvKaUcGLFDkgjsX
    fwkxBSoVuDSEOFldgDhilvm
    iAnSvDMQzamGvIFNydfjhr
    lHRPUnKgOxYQwWAltdELJNqqfgMRSmbBpSDnjOsfx
    10 rows selected.http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_random.htm#CDEJAHCB

  • Select from dual  into a variable through db links

    HI,I need to select value of current_timestamp in to a variable d1 of a remote database inside function.
    function (db_lnk varchar2)return number
    as
    dbl varchar2(10);
    begin
    dbl:=db_lnk;
    select current_timestamp into d1 from dual@dbl;
    end;
    but getting error table or v iew does not exist.
    if i do
    select current_timestamp into d1 from dual@'||dbl||';
    then it says database link name expected.
    How to achieve this?
    Thanks

    Peter Gjelstrup wrote:
    Foreign languages, foreign languages :-){noformat}*grins*{noformat} I know - and your English is miles better than my Danish (I'm assuming - hopefully correctly?! - that that's your 1st language based on your location!) which I don't even know any words of! *{:-)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • JDBC Lookup in PI 7.1 - SELECT ? FROM DUAL and Connection timed out

    Hi,
    We have a scenarios (Idoc to JMS) with JDBC lookup. We have used graphical JDBC lookup functionality.
    We are reading country names for a given country code from SAP in an external database table. The query is so simple. That  should not take much time
    Now the actual issues is,
    When we are executing the scenario, its taking quite a long time. Almost 6 minutes to excute a mapping. Which causing high performance issue in the Porduction.
    We started the inviestigation about found some interesting stuff. Here we have used Willy Introscope for the investigation.
    1. First few messages are taking quite a long time. LIke 6 minutes per messages. As i can see in the log i am getting below error in Willy,
    I dont know why PI is executing below queury apart from real secelt query to fetch the country name. I am getting below error: Error Message: Backends|ABCD2 mydatabase01-1526 (Oracle DB)|SQL|Dynamic|Query|SELECT ? FROM DUAL: java.sql.SQLException: Io exception: Connection timed out
    2. After couple of messages, interface works very normal. I mean rest of the messages works pretty fine.
    Please let me know if you have any idea about this error. What could be the problem for the issue.
    Thank you in advnace.
    Best Regards,
    Prasad.

    Did you check how many SQL requests were executed per one message ? Do you have a log of these SQL requests ?
    I assume that the country table is quite small, so that lookup should not be an issue.
    About this:
    >Message: Backends|ABCD2 mydatabase01-1526 (Oracle DB)|SQL|Dynamic|Query|SELECT ? FROM DUAL: >java.sql.SQLException: Io exception: Connection timed out
    1. I only know SELECT * FROM DUAL, not SELECT ? FROM DUAL. Better use the former
    2. the exception means that the database server can not be reached => check your network configuration
    So I assume that there is a network (performance) problem between PI and this Oracle server. Or the Oracle Server is so overloaded that it has (sometimes) problems in processing new requests.
    CSY
    Edited by: Christian Sy on Mar 9, 2010 10:17 AM

  • [11g] increasing efforts for select xmlserialize(content(...))) into ... from dual

    I wonder, that i don't get any feedback here (please see below).
    Can somebody first just confirm this observation?
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    "CORE 11.2.0.3.0 Production"
    TNS for Linux: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    NLSRTL 11.2.0.3.0 Production
    Oracle Database 11g Enterprise Edition 11.2.0.3.0 64bit Production
    PL/SQL 11.2.0.3.0 Production
    TNS for Linux: 11.2.0.3.0 Production
    I recognized for my application, that there is an increasing efforts (in terms of time) for executing
    (in a pl/sql package procedure invoked by a BIU trigger)
    SELECT XMLSERIALIZE(CONTENT(p_xml_data)) INTO v_xml_clob FROM DUAL;
    Here is a little demo sqlplus script:
    create or replace package test_pkg
    as
           procedure check_xml(
             p_xml_data in out nocopy xmltype);
    end;
    create or replace package body test_pkg
    as
           procedure log(
             p_txt in varchar2)
           is
             ts     TIMESTAMP WITH TIME ZONE := systimestamp;
           begin
             dbms_output.put_line(to_char(ts, 'hhmiss.FF3') || ':' || p_txt);
           end;
           procedure check_xml(
             p_xml_data in out nocopy xmltype)
           is
             v_xml_clob CLOB;
             v_len NUMBER;
           begin
             log('check_xml(): enter');
             SELECT XMLSERIALIZE(CONTENT(p_xml_data)) INTO v_xml_clob FROM DUAL;
             log('  serialized');
             v_len := dbms_lob.getlength(v_xml_clob);
             log('check_xml(): done - length = #'  || v_len);
           exception
           when others then
               oerror_pkg.set_ora_error;
               raise;
           end;
    end;
    drop table test_table;
    create table test_table(
           tid number(19,0),
           data xmltype
    create or replace trigger BIU_TEST_TABLE
    before insert or update on test_Table
    for each row
    declare
    begin
       test_pkg.check_xml(:new.data);
    end;
    insert into test_table(tid, data)
    select ctr_tab.ctr, '<root><node>' || ctr_tab.ctr || '</node></root>'
    from (  SELECT LEVEL ctr
           FROM dual
           CONNECT BY LEVEL <= 200) ctr_tab;
    The output is going like this
    021543.204:check_xml(): enter
    021543.204:  serialized
    021543.204:check_xml(): done - length = #32
    021543.206:check_xml(): enter
    021543.206:  serialized
    021543.206:check_xml(): done - length = #32
    021543.207:check_xml(): enter
    021543.208:  serialized
    021543.208:check_xml(): done - length = #32
    021543.209:check_xml(): enter
    021543.210:  serialized
    021543.210:check_xml(): done - length = #32
    021543.211:check_xml(): enter
    021543.212:  serialized
    021543.212:check_xml(): done - length = #32
    021543.214:check_xml(): enter
    021543.214:  serialized
    021543.214:check_xml(): done - length = #32
    021549.625:check_xml(): enter
    021549.664:  serialized
    021549.665:check_xml(): done - length = #34
    021549.708:check_xml(): enter
    021549.746:  serialized
    021549.747:check_xml(): done - length = #34
    021549.791:check_xml(): enter
    021549.829:  serialized
    021549.830:check_xml(): done - length = #34
    021549.874:check_xml(): enter
    021549.912:  serialized
    021549.913:check_xml(): done - length = #34
    When i filter it with a little perl script to extract the efforts (xmlserialize / dbms_lob.getlength):
    0 / 0
    0 / 0
    1 / 0
    1 / 0
    1 / 0
    0 / 0
    0 / 0
    0 / 1
    1 / 0
    0 / 0
    0 / 1
    1 / 0
    0 / 0
    0 / 1
    1 / 0
    0 / 1
    0 / 1
    0 / 0
    0 / 1
    0 / 0
    0 / 1
    0 / 0
    1 / 0
    0 / 1
    0 / 0
    31 / 1
    31 / 1
    32 / 1
    32 / 1
    32 / 1
    33 / 0
    33 / 0
    34 / 1
    34 / 0
    34 / 1
    34 / 0
    34 / 1
    34 / 1
    35 / 1
    35 / 1
    36 / 0
    36 / 1
    36 / 1
    37 / 1
    37 / 0
    37 / 1
    38 / 0
    38 / 0
    39 / 1
    38 / 1
    38 / 1
    38 / 1
    Unfortunately i can't easily change the way the insert from select is done (legacy code not under my control)
    Can someone tell me, if there is a way starting with the trigger to avoid those increasing efforts?
    - many thanks!
    best regards,
    Frank

    [ Addendum - 24.01.2014:
      This only worked for the test/demo program. It didn't work for my application.
       For my application i really had to move the logic to the INSERT before the trigger
       - similar to the 3rd posting for my monologue(!) here.
    A little step further:
    I also don't have the problem if i expand the code of the PROCEDURE test_pkg.check_xml(...) directly into the trigger
    - instead of invoking the PROCEDURE in the trigger:
    create or replace package test_pkg
    as
           procedure log(
             p_txt in varchar2);
    end;
    create or replace package body test_pkg
    as
           procedure log(
             p_txt in varchar2)
           is
             ts     TIMESTAMP WITH TIME ZONE := systimestamp;
           begin
             dbms_output.put_line(to_char(ts, 'hhmiss.FF3') || ':' || p_txt);
           end;
    end;
    drop table test_table;
    create table test_table( 
           tid number(19,0),
           data xmltype
    create or replace trigger BIU_TEST_TABLE
    before insert or update on test_Table
    for each row
    declare
    begin 
      -- test_pkg.check_xml(:new.data);
           declare
             v_xml_clob CLOB;
             v_len NUMBER;
           begin
             test_pkg.log('check_xml(): enter');
             SELECT XMLSERIALIZE(CONTENT(:new.data)) INTO v_xml_clob FROM DUAL;
             test_pkg.log('  serialized');
             v_len := dbms_lob.getlength(v_xml_clob);
            test_pkg.log('check_xml(): done - length = #'  || v_len);
           exception
           when others then
               oerror_pkg.set_ora_error;
               raise;
           end;
       end; 
    insert into test_table(tid, data)
    select ctr_tab.ctr, '<root><node>' || ctr_tab.ctr || '</node></root>'
    from (  SELECT LEVEL ctr
           FROM dual
           CONNECT BY LEVEL <= 200) ctr_tab;
    -- rollback;
    That gives some hint.
    Does oracle have some problem / limit for invoking procedures (functions) from triggers?
    Or only if those use certain features?
    An issue about deterministic and re-entrance?
    Well, that boxes me into a corner.
    Because the single package procedure implements a functionality at a central place - i.e. a single central place to extend it or to fix it.
    If i now have to expand its content (like a macro) into the triggers of the respective table i am in trouble.
    Because those tables (and their triggers) are dynamically generated by a compiler tool of a c++ client.
    This means for extension and fixes i need to change, test, deliver and deploy a list of c++ client processes :-(
    Is there any way around?
    How can i inform oracle that the invocation of a PL/SQL procedure is functionally identically with expanding the PL/SQL functions code into the trigger?
    rgds,
    Frank

  • Problem with:  select 'c' as X from dual

    Problem with 'select 'c' as X from dual'
    I get 2 different results when I execute the above with SQLPlus (or java) depending on the instance I am connected to. For one instance the result is a single character and for the other the character is padded with blanks to 32 chars in the SQLPlus window (and java). Does anyone know what database setting causes this to happen? Is it a version issue ?
    Test #1: Oracle 9.2.0.6 - SQLPlus result is padded with blanks
    SQL*Plus: Release 9.2.0.1.0 - Production on Mon Dec 10 09:27:58 2007
    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.6.0 - Production
    SQL> select 'c' as X from dual;
    X
    c
    SQL>
    Test #2 Oracle 9.2.0.1 SQLPlus result is a single character.
    SQL*Plus: Release 9.2.0.1.0 - Production on Mon Dec 10 09:29:27 2007
    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.1.0 - Production
    SQL> select 'c' as X from dual;
    X
    c
    SQL>

    Using 9.2.0.6 On AIX 5.2 I get the single byte result:
    UT1 > select 'c' as X from dual;
    X
    c
    If the databases are on different Oracle Homes you may want to check the sqlplus global logon files for any set commands.
    If you executed the two sql statements from different OS directories you may also want to check your sqlpath for sqlplus .logon files.
    Try issueing clear columns and repeating the statement. Are the results the same?
    HTH -- Mark D Powell --

  • Create a view with datatype from dual

    I have Windows XP with 10g 10.2.0.1.0
    I need to create a view from dual and with data type, such as NUMBER(5,2), NUMBER or VARCHAR2(20) .
    such as:
    create view test(view_test varchar2(20)) as (select view_test from dual)
    Please help. Thanks in advance.

    It does seem kind of odd, but you can do something like this with the CAST function:
    SQL> create view dual_view as
      2  select cast(null as number(5,2)) col1
      3        ,cast(null as date)    col2
      4        ,cast(null as varchar2(30)) col3
      5  from   dual;
    View created.
    SQL> desc dual_view
    Name                                      Null?    Type
    COL1                                               NUMBER(5,2)
    COL2                                               DATE
    COL3                                               VARCHAR2(30)I used NULLs but you can use actual values if you want.

  • Delay due to selecting sysdate from  dual

    Our application accessing dummy table dual frequently for getting current date and time. But some times this could reduce our database performance.
    How could we overcome this problem.
    ASH report_
    Top Events_
    latch: library cache      29.87      "5015593920","214","0"      26.57      address      number      tries
    Top SQL Statements_
    0vnruqfxmtu6q     Select to_number(to_char(Sysdate, 'YYYYMMDD')) from dual

    orianmoon wrote:
    Thanks for your replies,
    Please check this below link which shows my database performance at the time of running a particular sql , which is selecting sysdate using table dual. It created Lbrary cache latch contention.
    http://arun-itadmin.blogspot.com/2010/12/oracle-performance-screen.html
    My question is
    Is this the problem of frequent usage of table dual or usage of 'sysdate' ?
    It there any way to get date and time other than using sysdate function?
    Edited by: orianmoon on Dec 8, 2010 9:42 PMI don't see anything there that points the finger at SELECT SYSDATE FROM DUAL;

  • Bug: in ManagedDataAccess while fetch from "Select .., NULL, ... From dual"

    Hi,
    I have the problem with the new managed ODP.Net driver.
    If I fetch data from a select which has column with a fixed value "NULL" the driver decides after a certain amount of data that the value is not null any more. Which causes a lot of problems especially if you try to hide not needed blob data.
    The Problem somehow depends on the FetchSize of the command. It seems like the error occurs if more than one db round trip to fetch the result is necessary.
    System: Windows 7 64 Bit
    Platform: .net 4.0 x86
    database: 11g Release 11.2.0.3.0 - 64bit Production
    Oracle.ManagedDataAccess Version: 4.112.350
    I created a small example to reproduce the problem.
    Thanks for your help
    Dominik
    Stored Proc:
    create or replace PROCEDURE TestNullField
      v_IntPara IN NUMBER DEFAULT NULL ,
      v_StrPara IN VARCHAR2 DEFAULT NULL,
      cv_1 OUT SYS_REFCURSOR
    AS
    BEGIN
          OPEN cv_1 FOR
            select rownum, v_StrPara, NULL from dual connect by level <= v_IntPara;
            --select IDX, NULL, DESCRIPTION FROM TEST_BLOBTABLE;
    END;C# Code:
    using System;
    using System.Text;
    using Oracle.ManagedDataAccess.Client;
    using System.Data;
    namespace OracleBlobTest
        class Program
            private static string _connectionString = @"User ID=YourUser;Password=YourPwd;Data Source=YourServer:YourPort/YourSchema;";
            private static string _spName = @"TestNullField";
            private static string _strPara = @" Long test string";
            private static int _intPara = 200;
            static void Main(string[] args)
                using (OracleConnection connection = new OracleConnection(_connectionString))
                    using (OracleCommand cmd = connection.CreateCommand())
                        cmd.CommandText = _spName;
                        cmd.CommandType = CommandType.StoredProcedure;
                        connection.Open();
                        string alongString = _strPara;
                        while (alongString.Length < 2000)
                            alongString += alongString;
                        alongString = alongString.Substring(0, 2000);
                        OracleCommandBuilder.DeriveParameters(cmd);
                        if (cmd.Parameters.Count > 0 && (cmd.Parameters[0]).Direction != ParameterDirection.ReturnValue)
                            cmd.Parameters[0].Value = _intPara;
                            cmd.Parameters[1].Value = alongString;
                        // change this to change the moment when it starts to go wrong
                        ///cmd.FetchSize = 5000;
                        using (OracleDataReader reader = cmd.ExecuteReader())
                            int count = 0;
                            while (reader.Read())
                                count++;
                                for (int idx = 0; idx < reader.FieldCount; idx++)
                                    if (reader.GetName(idx) == "NULL")
                                        if (!reader.IsDBNull(idx))
                                            //something is very wrong here - why is not not null any more???
                                            Console.WriteLine("Fix NULL Field[{0}] {1} is not null >{2}< in row {3} ", idx, reader.GetName(idx), reader[idx], count);
                            Console.WriteLine("Rows found: " + count);
                    connection.Close();
                Console.WriteLine("done press enter");
                Console.ReadLine();
    }Edited by: user540519 on 10.12.2012 15:11
    Edited by: user540519 on 19.12.2012 13:50

    Hello
    I ran the testcase here and reproduced the issue on 32 bit unmanaged beta v4.0.30319
    note: same testcase works with Oracle.DataAccess (but not with managed).
    This appears to match unpublished defect Bug 14666093 and is meant to be fixed in a later beta release.
    Some things I noticed when testing
    with the default fetchsize the breaking point is 67 iterations.
    e.g.
    private static int _intPara = 66;    // Works
    private static int _intPara = 67;  // Fails
    If I increase the fetchsize then it breaks at different values as you noticed..
    Hope this helps.
    Kind Regards
    John

Maybe you are looking for

  • Lost script after re-downloading Adobe Story

    Hello, I am trying to find out where one of my scripts has gone, I had invested a lot of time into the script. My laptop was having problems so I recovered it, & re-downloaded Adobe Story. When Adobe Story opened, I noticed I only have one script the

  • My date/time is incorrect. System pref freezes everytime I try to click date/time. Safari won't let me search the web, if i type in any link it won't respond.

    I downloaded mavericks 10.9 everything has been working fine and now I turned my macbook on and the date had been changes. It now will not let me get into the date time tab in system preferences and everytime i try to click it, it just freezes and ha

  • Organizing raw and jpeg of same pic

    i shoot my photos in raw and jpeg formats with my canon camera.  when i tried to organize them in elements organizer i see the same picture twice.  how do i make my organizer cleaner by only showing the picture only once?  i think i had done it befor

  • Adobe After Effects strange problem

    Hello I am having strange problem in AE. I am beginner, but I want to scale (item will change when the time will go to 2 seconds), but when I click CTRL + S and I can change. It won't save. You know there should be some kind of bullet, but there's no

  • Table heights inconsistent - Please help!

    I'm not at all savvy with web programming. I have lots of experience creating HTML e-mails in DreamWeaver but this is the first complete site I've designed and built using DW8. http://www.10speedstudio.com/testsite I'm almost done except I cannot fig