Space in the Oracle Query

Hi
Can some one help me with this request
I have a Table which has stored date and time as varchar in the format give below
20061026 081535
20061026 091035
20061026 081535
20061026 091035
I would like to know how to capture records created 2 hrs back.. Lets says sydate and time is 20061026 040001 i need records created between 20061026 02 to 20061026 04 inclusive of the time specified
Also there is a space between the Date and the Time , since that is how it is stored in the database..
Awaiting your help..
thanks
Ur Friend

sql>SELECT * FROM T;
DT DT1 
27-OCT-06 08.15.35.000000 AM  20061027 081535 
27-OCT-06 09.10.35.000000 AM  20061027 091035 
27-OCT-06 08.15.35.000000 AM  20061027 081535 
27-OCT-06 09.10.35.000000 AM  20061027 091035 
sql>
SELECT t.dt,t.dt1,current_timestamp
FROM T
WHERE TO_TIMESTAMP(DT1,'YYYYMMDD HHMISS') BETWEEN
    TO_TIMESTAMP(TO_CHAR(CURRENT_TIMESTAMP-(6/24),'DDMMYYYY HH24MISS'),'DDMMYYYY HH24MISS')
    AND CURRENT_TIMESTAMP
DT DT1 CURRENT_TIMESTAMP
27-OCT-06 09.10.35.000000 AM  20061027 091035  27-OCT-06 02.51.55.625000 PM +05:30 
27-OCT-06 09.10.35.000000 AM  20061027 091035  27-OCT-06 02.51.55.625000 PM +05:30                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • Limit the Oracle query run time using Pro*C

    All,
    I would like to limit my sql query for say a duration of only 10-15 secs. I do not want to kill the oracle process but send a signal to the C program with some message that " its taking more time"
    Is there an param which I can use it to limit, without killing or shutting down the oracle session or process.
    Thanks in advance

    My answer is only for 1. problem (about ORA-01458)
    I think that you use declaration for cursor C0 with a varchar
    variable before you ininitialize length (member .len of varchar
    structure) of this variable.
    It's famous that many errors come from uninitialized varchar
    variables in Pro*C.

  • Database slow; How to check the Oracle query timings

    Hi,
    I have a quick question regarding a troubleshooting iam currently working on.
    We have a J2EE application runnig on WLS 81 SP3.
    We are experiencing a problem where the customer response time on our application is "too slow". We checked our N/W and they seems to be OK. The Iplanet webserver and BEA application servers looks good but on the Oracle database box - i saw "iowait" (when doing top UNIX command) to be 50-60 % which is extremly high. We are suspecting this to be our issue as the "iowait" is very high at the DATABASE box hence causing BEA servers to show "slow response" on certain pages which are database accentric.
    Now, in order to proove that the queries are taking "too longer" to execute from the time BEA server requested and it actually got the reply back from database, i need to dig down and get some "profiling" (due to some political reasons, i can request to turn on profling at the moment) done. So, is there any way i can verify the response time when the BEA server requested some information from the database and the time when Oracle database responded with all the information requested ?
    thanks for your help,

    Yes. Create a Date object prior to the database call. Then create another one when the call completes. Convert both to mililseconds and subtract. You will have network latency in that statistic, but especially if you are using connection pools, the vast majority should be database access.
    Another option is to turn on tk_prof or create an EXPLAIN plan table in Oracle. That will show the 'cost' of each query. Also, try running statistics on the database, that should help the optimizer.
    - Saish

  • Dynamic Pages: how to overide the default format returned from the oracle query.

    When writing a dynamic page, portal always displays any return from a database query in a default format or grey background table:
    <TABLE border="0" cellspacing=0 cellpadding=2 style="background-color:#E0E0D0">
    <TR>
    <TH ALIGN="LEFT" style="background-color:#C0C0A0" > </TH>
    </TR>
    <TD ALIGN="LEFT" valign="TOP" WIDTH="0">
    Is there anyway to change this or this how the
    function
    PORTAL30.wwv_render_report.show always works?
    Thanks in advance!

    James,
    Please see posting http://technet.oracle.com:89/ubb/Forum70/HTML/000073.html.
    Just a reminder, please search the forum before posting your question. It's quite likely that someone else has already asked the same question.
    Regards,
    Jerry
    null

  • Not enough space when download oracle

    I am the beginner of Linux, and I am try to download Oracle 9i to /usr/oracle directory, but it says I don't have enough space to contain the files. I am confused because I have a partition with size of 8G for the /usr directory. How come I don't have engouh space for the oracle files, which are less than 2G. Anyone could help me?
    Thanks!!!

    Simply do
    #df
    And you will see report about "filesystem disk usage"
    To the right you will see "Mounted On" - that is the column with points which you should create before(with names), there you will find a point where you wont to copy information - "/usr", after check other columns. For example Available .... if there is not enough space better to reinstall system, or use disk druid. Better to do the first.
    Besr regards Anton

  • ORACLE query FROM TOAD TOOL  TO XL

    hi,
    i want to export all the o/p of the ORACLE query FROM TOAD TOOL into an EXCEL-SHEET.
    FOR EX: SELECT EMPNO,ENAME FROM EMP
    EMPNO ENAME
    1 X
    2 Y
    THANKS IN ADVANCE

    Even if it's not a Toad forum here... run your query, right click on the result sheet, then "Save As", and choose "XLS File"...
    Nicolas.

  • How to deal with the using up space of /opt/oracle

    Hello, all
    We have an Oracle 10g preinstalled in a linux server (Rh 9). Now the system reports that the /opt/oracle is using up. The alert says:
         Filesystem /opt/oracle has only 19% available space
    Because I didn't install the Oracle dababase, I didn't have the chance to select a place for filesystem. Now the /opt/oracle is on the /dev/sda6 which is only 7.1G. I want to know what kind of information are stored here? Should it keep growing? Our database running on the Oracle is a small one, and it shouldn't occupy so much space. By the way, I scheduled the backup to disk (another hard disk) everyday. Is there any copy of the backup on /opt/oracle? How can I deal with it?
    Any advice is highly appreciated!
    Qian
    Message was edited by:
    QianChen
    Message was edited by:
    QianChen

    Typically, the growth files on your binary directory is going to be in the $ORACLE_HOME/network/logs/listener.log , any tracelog, sqlnet.log, or any files that get accidentally dumped in $ORACLE_HOME/dbs.
    I would check there first.
    Also, try scanning for the last few files written/updated in the past 30 days.
    #30 biggest files modified in last little while:
    find . -xdev -type f -mtime -14 -exec ls -l {} \; | sort -nk 5,5 | tail -30

  • Different results for the same query and same data !  (oracle 9i)

    Hi,
    This is a mystery for me. I've got on my database exactly the same data that my customer (exported schema). We both launch the same query (generated by the software that we sold him). This query has a criteria IN (SELECT MAX()...) to get only data from the last year.
    The query gives 477 rows on my computer (correct answer), but no row on his! We have the same data! The only difference is the Oracle release : 9.2.0.6.0 for him, 9.2.0.1.0 for me.
    If he executes the subquery alone, it gives the expected result.
    If he replaces the MAX() in the subquery by the returned value (year 2016), he gets his 477 rows.
    I've rewritten the query with a NOT EXISTS, and now all is fine. (Less efficient but it works).
    I have no rational explication. Did I miss something ?
    Thanks for any answer.
    This is the query:
    SELECT ...
    FROM
    CRA, GRA, ...
    WHERE
    /* subselect */
    (CRA.COLLCOD, CRA.CRANEXE, CRA.CRANCODBUD, CRA.GRANNUM, CRA.CRANCOD1, CRA.CRANCOD2, CRA.CRANCOD3, CRA.CRANCOD4)
    IN (
    SELECT b.COLLCOD, MAX(cranexe), b.CRANCODBUD, b.GRANNUM, b.CRANCOD1, b.CRANCOD2, b.CRANCOD3, b.CRANCOD4
    FROM CRA b
    GROUP BY b.COLLCOD, b.CRANCODBUD, b.GRANNUM, b.CRANCOD1, b.CRANCOD2, b.CRANCOD3, b.CRANCOD4
    AND... /* other filters and joins */

    v9.2.0.1 was full of bugs. a lot of these bugs had to do with "incorrect results", typically associated with old stats or complex queries (certain types of subqueries were very likely to give wrong resutls, due to the way they were rewritten by the optimizer).
    apply the 9.2.0.6 patch set

  • A simple query in My SQL what is the similer query for that in Oracle ???

    hello friends
    In My Sql if i have 1000 records in a table and i want to get the records from 400 to 550 then it is posible by giving the following query
    Select * from Table a , table b where condition "List 400,550" gives the records from 400 to 550
    what is the coresponding query for this in oracle database
    any one help me pls
    mail me to [email protected]

    Genericly, if you want records N through M from a SELECT statement, there's a wonderful article on asktom.oracle.com
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:127412348064
    Justin

  • Give me the sql query which calculte the table size in oracle 10g ecc 6.0

    Hi expert,
    Please  give me the sql query which calculte the table size in oracle 10g ecc 6.0.
    Regards

    Orkun Gedik wrote:
    select segment_name, sum(bytes)/(1024*1024) from dba_segments where segment_name = '<TABLE_NAME>' group by segment_name;
    Hi,
    This delivers possibly wrong data in MCOD installations.
    Depending on Oracle Version and Patchlevel dba_segments does not always have the correct data,
    at any time esp. for indexes right after being rebuild parallel (Even in DB02 because it is using USER_SEGMENTS).
    Takes a day to get the data back in line (never found out, who did the correction at night, could be RSCOLL00 ?).
    Use above statement with "OWNER = " in WHERE for MCOD or connect as schema owner and use USER_SEGMENTS.
    Use with
    segment_name LIKE '<TABLE_NAME>%'
    if you like to see the related indexes as well.
    For partitioned objects, a join from dba_tables / dba_indexes to dba_tab_partitions/dba_ind_partitions to dba_segments
    might be needed, esp. for hash partitioned tables, depending on how they have been created ( partition names SYS_xxxx).
    Volker

  • Oracle.sql.BLOB.freeTemporary() is not freeing TEMP space in the database

    Hi Folks,
    We are using oracle.sql.BLOB to store some file information into the database.
    Allocation of the temp space is done as below
    BLOB blob=BLOB.createTemporary(conn, false, BLOB.DURATION_SESSION); // this results in the usage of TEMP space from database
    And subsequent release is done as below
    blob.freeTemporary(); // this should have release the space from the database.
    This is on Oracle 10g, Java 1.6, ojdbc6.jar There are no exceptions. Even a simple program results in the same.
    Anybody faced something similar? Any pointers would be really appreciated.
    Thanks,
    Deva
    Edited by: user10728663 on Oct 11, 2011 5:33 AM

    Thanks a lot for the information.
    Memory is fine. And I am able to reproduce this within the scope of a simple example as well.
    Would you have any reference to the thread which had earlier reported this as a bug. I tried a reasonable amount of search in the forum, but no success.
    Thanks very much for any pointers.

  • Why do I get spaces between the printed fields? (Oracle 10G)

    Hi!
    I use Oracle 10G and I have a program that doesn't work the way it does on previous versions of Oracle. Or maybe it's a wrong options?!?
    Well i need to print the fields from a table with no spaces between them. Instead I get spaces between the fields. As if the dimension of the printed field is three times the real dimension of the field (even if I use SUBST, RTRIM, LPAD).
    For example I have
    SELECT '1', '2' FROM dual;
    I get "1 2 " instead of "12"
    The program is something like this:
    SET SCAN ON
    SET SPACE 0
    SET PAGESIZE 0
    SET PAUSE OFF
    SET FEEDBACK OFF
    SET HEADING OFF
    SET EMBEDDED ON
    SET VERIFY OFF
    SET TERMOUT OFF
    SET LINESIZE 4750
    spool &&4
    Select campo1, campo2 from tabella;
    Oh! It's not possible to concatenate the fields. campo1 || campo1. I get error, I presume, because of the dimension of the line (4750).
    Thanks,
    Miky

    SET COLSEP doesn't work! SPACE 0 should do the same, but doesn't work either When you complains that solution doesn't work, you should provide us the output you got. Because as I showed, and as shoblovk show it worked fine on our side.
    Anyway, what's the version of your Oracle client (SQL*Plus), OS... ?
    Nicolas.
    PS : and use tags as well &#091;pre&#093;paste your code here&#091;/pre&#093;
    Message was edited by:
    N. Gasparotto

  • Oracle query export into the Excel file

    Hi,
    How can i automatically export oracle query result into the excel file in oracle?

    SQL and PL/SQL FAQ
    Re: Excel query to Oracle Database
    http://blog.mclaughlinsoftware.com/microsoft-excel/how-to-query-oracle-from-excel-2007/
    Edited by: swapnil kambli on May 28, 2013 11:07 PM

  • Oracle Repors 3.2(using the Dynamic query)

    How can I create a report with dynamic queries?
    For example, I have a form with several check_boxes which represent the field_names.My user selecting the fields by checking the check_boxes in the form. After finishing the user's selection, i want to generate a query based on the fields chosen by the user and a report needs to be generated based on the dynamic query.
    Can anyone has any idea on this requirement? Quick response is appreciated. Thanks.

    hello,
    this sounds like the perfect oportunity for using the runtime customization feature of oracle reports 6i.
    using that you can either custimize an existing report using an XML file or -which fits more your requirement- encode a report-definition in XML and run the XML file.
    you could dynamically create that file according to the users selection and then run this file.
    you find more about runtime customization in the documentation of reports 6i.
    regards,
    the oracle reports team

  • The Oracle database engine and forms - functionality query

    I have an interest in establishing how the Oracle System Catalogues cope with particular changes. I have never used Oracle, but I have carried out the same test on another RDBMS. If I had access to Oracle I would have carried out this test myself.
    The test goes as follows.
    Create a new database.
    Create a new simple table, with just a few columns.
    Create a form for the table, and add a few rows.
    Rename the table or a column – if you can’t, then the RDBMS is Code Class.
    If you can rename the table or a column, then do so, and invoke the form that you used before changing the table or column name. If it doesn’t work, the RDBMS is Code Class; if it does then the RDBMS is Identifier Class.
    In an Identifier Class RDBMS changes of column or relation/table name will not interfere with the operation of any form already in place based on that table.
    I'll be very grateful if anybody can give me a definitive answer on this, either through already having explored the issue or by running the test.

    Hello again William,
    now it becomes challenging. The conceptual shift required to get to Identifiers is similar in scale to the shift involved in going from Newtonian Mechanics to Quantum Mechanics or from Cartesian Space-Time to Special Relativity, with the added proviso that the concept of identity built into the Relational Model is implicit rather than explicit as respectively in the cases of Newton and Descartes.
    Your "you are not expecting.." sentence is a perfect statement of where I am - I'm not looking for the RDBMS to have any impact on application code - that would be a truly ridiculous expectation; this would make some crazy version of a cascade update, with remoteness as an extra complication. In IC applications (including RDBMSs) cascade updates are never needed.
    The next sentence also has a very strong aspect ("allow applications ... to .. compilation time) but is weaker in the "simply hoping" and "might". I havn't developed a RDBMS that does that, although I hope to participate in such a development exercise soon, but I have developed an application that does exactly what you say. Binding/joining depends on something permanent rather than something transient, where names and abbreviations are all transient, as are all pure attributes once they have had identity (and relative position) stripped out them.
    In your next paragraph I disagree that there is only a shift of problem. The dropping of whole tables or the deletion of columns is on a different scale from the changes that I am talking about, which do not but could get sensibly reflected in the current Code Class RDBMSs and applications. I'm aware that no application development tool allows what you say, (the problem is actually in the system tables) but I have achieved the completely analogous result in the application that I have developed.
    Your comments about the AREAS table precisely highlight the issues of permanence and transience on which all of my work sits. What are you doing when you drop the table and replace it with a table with the same name? Do you want to think of the "new" table as the SAME as the "old" table or is it something entirely DIFFERENT, in which case giving it the name of a table that you have dropped might easily result in serious confusion.
    If the new table is doing the same conceptual job as the old, then I would certainly want the continuity of its existence to be explicitly preserved, via the enduring identifier value (which reflects the fact that we are thinking of the table as having continuity of existence). So I would alter the table rather than dropping it and recreating it.
    If I have ended up in a cul-de-sac (I've been there) and I have to throw away the table and all its related operators, then that is what happens if I don't get it right first time. I don't want any continuity, and I'll have to junk all the form and report etc operators unless I want to preserve some bits for my next attempt. I certainly won't expect anything to continue to work, because there is nothing to work on.
    Your use of the expression "fancy name-independent code" is disappointing in all respects. I experience your use of "fancy" as sarcastic, and my full expression for "name-independent code" is "attribute independent and relative position independent identifier" whose acronym is "airpii". This is not just name-independent, it's independent of all other attribute and relative position values in the same row. It's certainly not a code: the word does not have a place in Identifier talk, since it has been replaced by abbreviations and acronyms, which are undiluted attribute; they don't have identity mixed up in them as with the "codes" of the "Codes Mistake". (In RDBMSs the mistake is called the "Names Mistake" because table and column names bear identity as well as attribute; there are no codes.)
    I very much hope that our dialogue can continue - other dialogues have stopped at this sort of stage. On my website www.identifiers.org there is a page called "Identifiers - a Visual Representation" that sets out to communicate identifiers visually, that I created to communicate this entirely new concept in a different way after another database professional got stuck. I understand from another forum user that there may be a problem getting hold of the pdf file concerned if using Firefox - please let me know.
    I have an RDBMS application on a SCO partition on a PC that proved identifiers for me. I can input a work instruction successfully using one set of abbreviations (the codes of old) and the stored instruction row makes no reference to the abbreviations that I have input - there's just a single identifier value in the appropriate column of the work instructions relation. The relationship between the abbreviations and the identifier value becomes clear from rows in other relations.
    If I then want for some good reason (some purely operational entity has been renamed) to change one of the abbreviations when also changing the full name, I can do so in the relevant relation - this is an abbreviation rather than a code that I am now dealing with; I can change it because it's not also used for joins.
    When I input the next work instruction I use the new abbreviation rather than the old; the form is entirely happy and works fine, and exactly the same identifier value ends up in the appropriate column of the work instruction relation. So I have input a different set of values to achieve exactly the same result. Is this crazy? No! This reflects the ways in which we naturally think and talk, and at last the application makes sense - I don't have to use a code that does not tie up with the name. The core of the issue is that I have been able to reflect external CHANGE fully and successfully in the database. We are surrounded by change, but RDBMSs and applications currently do not allow us to process it properly.
    I acknowledge that no application development tool works in this way at present, but that's the fault of the architecture of system tables, which I intend to remedy. One can't remove the Codes Mistake from these tables.
    However Identifier Class Applications can be developed using Code Class RDBMSs, because the developer has control over the application relation design, which can be carried out under identifier principles. I redeveloped from relation design scratch a very successful application, so I had a good placebo. In my environment I needed a 4GL form development tool so that I could get identifier values (and other attribute values) from attribute input rather than being limited to searching for a "code" to get other row values.
    If seeing is believing and of interest, then we might arrange for you to see the IC application working.
    Yours,
    George

Maybe you are looking for