How to get exact query of sql in oracle?

Hi all,
Hope doing well,
sir i was using one query of sql that is here:
Declare @nshiftmax datetime
set @nshiftmax=convert(time,DATEADD(N,1439,0))
print @nshiftmax
so it is retreiving the result 1/1/1900 11:59 p.m
and one more query is there
Declare @nshiftmax datetime
set @nshiftmax=convert(time,DATEADD(N,0,0))
print @nshiftmax
so it is retreiving the result 1/1/1900 12:00 a.m
how to same result in oracle query.
thanks in advance.

952646 wrote:
Hi all,
Hope doing well,
sir i was using one query of sql that is here:
You mean you have these statements in SQL Server?
Please remember that SQL is an access language for relational databases. It is used by all of the major rdbms products. "SQL Server" is the name of Microsoft's rdbms product. Do not let Microsoft's marketing flaks lull you into thinking SQL = SQL Server.
Declare @nshiftmax datetime
set @nshiftmax=convert(time,DATEADD(N,1439,0))
print @nshiftmax
so it is retreiving the result 1/1/1900 11:59 p.m
and one more query is there
Declare @nshiftmax datetime
set @nshiftmax=convert(time,DATEADD(N,0,0))
print @nshiftmax
so it is retreiving the result 1/1/1900 12:00 a.m
how to same result in oracle query.
thanks in advance.

Similar Messages

  • How to write exact query from sql to oracle?

    Hi all,
    hope doing well,
    sir i am using one query in sql that is
    declare @earlyleavers varchar(max), @earlyleavers1 int
    select @earlyleavers1 = DATEDIFF(Minute,'1900/01/01 10:00:00.000','1900/01/01 11:00:00.000')
    select @earlyleavers = CONVERT(char(8),DATEADD(n,@earlyleavers1,0),108)
    print @earlyleavers
    and i am getting the result like this
    01:00:00
    how to get the same result in oracle
    please help me.
    thanks in advance.

    952646 wrote:
    sir i need result in this format 01:00 not in 1 format.The name is Billy and not "sir". :-)
    Is "01:00" a string format or an elapsed time format?
    The number that the above code returns is decimal hours. So a number value of 1.5 means 1h30m or 1:30 or however you need to render that.
    And that is the question. Is this a rendering issue? Must the result be rendered in a specific format?
    If so, then this is not a SQL or PL/SQL issue. The server returning decimal hours is acceptable. The client (e.g. C#/Java code) needs to decide how to format and render this meaningful value. Keep in mind that if the sever code returns "1.30" or "1:30" for example, these are string/text data and pretty much meaningless. And it does not make sense for server code to return meaningless text strings to the client.
    If the client expects a duration and not a numeric data type, then the server code should return a value of the INTERVAL DAY TO SECOND data type.
    This data type specifically exists to contain duration values between to dates or times.
    In this case, the server code will expect the host (C#/Java) variable to be of data type INTERVAL DAY TO SECOND. The server code will look something as follows:
    SQL> declare
      2          earlyleavers    interval day to second;
      3  begin
      4          earlyleavers := NumToDSinterval(
      5                                  (to_date('1900/01/01 11:00:00','yyyy/mm/dd hh24:mi:ss') -
      6                                  to_date('1900/01/01 10:00:00','yyyy/mm/dd hh24:mi:ss') ) * 24,
      7                                  'hour'
      8                          );
      9 
    10          dbms_output.put_line( to_char(earlyleavers) );
    11  end;
    12  /
    +00 01:00:00.000000
    PL/SQL procedure successfully completed.
    SQL>An interval-to-string conversion function is used (with default formatting) to "print" the interval value via DBMS_OUTPUT. The default format includes days and a sign to indicate a positive or negative interval. Look at the SQL Reference manual for the format masks that can be used.
    The important thing is to treat data values correctly using the most appropriate type. And intervals should either be a decimal day/hour/minute numeric type, or an actual interval type.

  • How to get exact match when working with Oracle Text?

    Hi,
    I'm running Oracle9i Database R2.
    I would like to know how do I get exact match when working with Oracle Text.
    DROP TABLE T_TEST_1;
    CREATE TABLE T_TEST_1 (text VARCHAR2(30));
    INSERT INTO T_TEST_1 VALUES('Management');
    INSERT INTO T_TEST_1 VALUES('Busines Management Practice');
    INSERT INTO T_TEST_1 VALUES('Human Resource Management');
    COMMIT;
    DROP INDEX T_TEST_1;
    CREATE INDEX T_TEST_1_IDX ON T_TEST_1(text) INDEXTYPE IS CTXSYS.CONTEXT;
    SELECT * FROM T_TEST_1 WHERE CONTAINS(text, 'Management')>0;
    The above query will return 3 rows. How do I make Oracle Text to return me only the first row - which is exact match because sometimes my users need to look for exact match term.
    Please advise.
    Regards,
    Jap.

    But I would like to utilize the Oracle Text index. Don't know your db version, but if you slightly redefine your index you can achieve this (at least on my 11g instance) :
    SQL> create table t_test_1 (text varchar2(30))
      2  /
    Table created.
    SQL> insert into t_test_1 values ('Management')
      2  /
    1 row created.
    SQL> insert into t_test_1 values ('Busines Management Practice')
      2  /
    1 row created.
    SQL> insert into t_test_1 values ('Human Resource Management')
      2  /
    1 row created.
    SQL>
    SQL> create index t_test_1_idx on t_test_1(text) indextype is ctxsys.context filter by text
      2  /
    Index created.
    SQL> set autotrace on explain
    SQL>
    SQL> select text, score (1)
      2    from t_test_1
      3   where contains (text, 'Management and sdata(text="Management")', 1) > 0
      4  /
    TEXT                             SCORE(1)
    Management                              3
    Execution Plan
    Plan hash value: 4163886076
    | Id  | Operation                   | Name         | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |              |     1 |    29 |     4   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| T_TEST_1     |     1 |    29 |     4   (0)| 00:00:01 |
    |*  2 |   DOMAIN INDEX              | T_TEST_1_IDX |       |       |     4   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("CTXSYS"."CONTAINS"("TEXT",'Management and
                  sdata(text="Management")',1)>0)
    Note
       - dynamic sampling used for this statementJust read that you indeed mentioned your db version in your first post.
    Not sure though if above method is already available in 9i ...
    Message was edited by:
    michaels

  • How to get the query result of improvement (Before and After ) using sql de

    how to get the query result of improvement (Before and After ) using sql developer.

    Check
    http://www.oracle.com/technetwork/articles/sql/exploring-sql-developer-1637307.html

  • How to get this output using sql query?

    Hi,
      How to get this output using sql query?
    Sno Name Age ADD Result
    1 Anil 23 delhi Pass
    2 Shruti 25 bangalor Pass
    3 Arun 21 delhi fail
    4 Sonu 23 pune Pass
    5 Roji 26 hydrabad fail
    6 Anil 28 delhi pass
    Output
    Sno Name Age ADD Result
    1 Anil 23 delhi pass
    28 delhi pass

    Hi Vamshi,
    Your query is not pretty clear.
    write the select query using Name = 'ANIL' in where condition and display the ouput using Control-break statements.
    Regards,
    Kannan

  • How to get the Query output to Excel

    Hi ,
    Can you tell me how to get the Query output to excel with out using any third party tool?
    Can you tell me how to write the code in Webservice and call it..
    Please explain it Elaboartly..
    Thanks in Advance!!!
    Mini

    whats your source system?
    you can use Live office, or query as a webservice if you are getting data from universe
    if you're getting data from SAP BI query and you have a java stack on your netweaver then you can get the data directly using sap bi connector in xcelsius.
    good luck

  • OAF page : How to get its query performance from Oracle Apps Screen?

    Hi Team,
    How to get the query performance of an OAF page using Oracle Apps Screen ??
    regards
    sridhar

    Go through this link
    Any tools to validate performance of an OAF Page?
    However do let us know as these queries performance can be check through backend also
    Thanks
    --Anil
    http://oracleanil.blogspot.com/

  • How to get login ID in SQL?

    Hi,
    How to get login Id in sql?
    such as "select * from table1 where userlogined=:{$loginid$}"?
    Best Regards,
    Jason Gao

    Hi,
    You would need to create a parameter in your report called userloginid select the paramter data type to match that of the datatype this value is stored as in the table.
    then the correct syntax would be select * from table1 where userloginid=:userloginid
    Hope this helps,
    Domnic

  • How can get a database like ****.SQL file for test in sqlplus in oracle8i

    How can get a database like ****.SQL file for test in sqlplus in oracle8i,I am a beginner,thanks

    I'll give it a guess as to what it is you want but I'm afraid you'll have to give some more information to go on. I appreciate it's difficult for people who are beginners or who don't have English as their first language.
    Are you trying to run a SQL file? From SQL*plus you can do either of these:
    SQL> start my_file
    or
    SQL> @my_file
    N.B.: if th efile has a .sql extension you don't need to include it, but you do for any other file extension e.g.
    SQL> @myfile.run
    Here is the page Vijay referred to:
    Re: Physical storage Checks & adding disk on server. I hope you find it useful.
    You will more helpful links (including links to the Oracle on-line manuals at this page:
    Re: How to attach a java bean in forms6i
    good luck, APC

  • How to get  Unapplied Amount with SQL or API in AR/ORACLE RECEIVABLES

    Hi ,
    how to get Unapplied Amount with SQL or API in AR/ORACLE RECEIVABLES.
    who can help me ? Thank you very much !

    i get it from private API.
    SELECT SUM(decode(ra.status, 'UNAPP', nvl(ra.amount_applied, 0), 0)) unapplied_amount
    FROM ar_receivable_applications ra
    WHERE ra.cash_receipt_id = 1820
    AND ra.status IN ('UNAPP', 'ACTIVITY')

  • How to get exact date using to_date

    Hi all
    how to get exact date over there
    select TO_DATE(TRUNC(PLLA.CREATION_DATE),'DD-MON-YYYY'),TRUNC(PLLA.CREATION_DATE),round(PLLA.CREATION_DATE),
    TO_DATE(round(PLLA.CREATION_DATE),'DD-MON-YYYY'),TO_DATE(PLLA.CREATION_DATE,'DD-MON-YYYY'),PLLA.CREATION_DATE,
    TO_DATE(TRUNC(PLLA.CREATION_DATE)),TO_DATE(round(PLLA.CREATION_DATE))
    from po_line_locations_all plla.
    In one of the plsql program i want to compare the creation date with given date where as creation date is in Timestamp format

    Hi,
    Use trunc or to_char with masking like 'dd/mm/yyyy' format. If this does not solve your problem then do post your sample input and sample output. As I am unable to make out what is your actual problem.
    Regards

  • How to get organization id as input in oracle alerts

    Hi,
    How to get organization id as input in oracle alerts
    Following is the my sql script
    SELECT
    poh.segment1
    ,pv.vendor_name
    ,poh.end_date
    ,flv.description
    ,flv.tag
    INTO
    &po_num
    ,&vendor_name
    ,&end_date
    ,&to_mail
    ,&cc_mail
    FROM
    po_headers_all poh
    ,po_vendors pv
    ,hr_locations hrl
    ,org_organization_definitions ood
    ,fnd_lookup_values_vl flv
    WHERE
    poh.vendor_id = pv.vendor_id
    and poh.type_lookup_code in ('CONTRACT','BLANKET')
    and poh.attribute2 = 'Contracts, Services'
    and hrl.ship_to_location_id = poh.ship_to_location_id
    and hrl.inventory_organization_id = ood.organization_id
    and ood.organization_code = flv.lookup_code
    and flv.lookup_type='NGHA_EAM_ORG_EMAIL'
    and flv.lookup_code = 'RCE'
    and to_char(poh.end_date, 'dd-mm-yyyy') = to_char(sysdate+180, 'dd-mm-yyyy')
    Here i did organization code as hard code , but i want here organization code dynamically.
    Hanimi.

    Can you not use the function FND_PROFILE.VALUE ('ORG_ID') or something similar ?
    See ML Doc 289563.1 (Unable To Use More Than 16 Functions Calls In Alert Definition) as an example.
    HTH
    Srini

  • How to get Workflow code/wtf file from Oracle Customization Form

    Hi All,
    I am new to this forum. Can some one please help me how to get this wft file from customized oracle PO form ?
    Thanks,

    Pl post details of OS, database and EBS versions.
    What is "this wft" file ? WFT files are txt files of workflow definitions that can be downloaded from the database (or uploaded to the database) using WFLOAD utility.
    HOW TO DOWNLOAD WORKFLOW FILE .wft          [Document 578248.1]
    How To Update and Move Workflow From One Instance to Another?          [Document 398460.1]
    HTH
    Srini

  • How to get text of Last SQL Query

    Sorry if this has been covered, but the search page keeps erring on me.
    I am trying to figure out how to get the text of the last SQL statement executed (succesfully or unsuccesfully) by my current login.
    What it is, is i want in the exception handler of my procedure to be able to dump the text of the Query which was last run into the log file.
    Any help with this will be greatly appreciated!
    Thanks in advance,
    Aaron.
    [email protected]

    Well, ive been trying V$SQLTEXT in conjunction with V$SESSION and USERENV('SESSIONID'). This gets me my SQL statements, but the SQL_HASH_VALUE and PREV_HASH_VALUE, which are supposed to be the current and previous statements respectively always are the same and always point to the current statement..... is there some sort of flag you have to set to get PREV_HASH_VALUE (and PREV_SQL_ADDR) to actually point to the **PREVIOUS** statement??

  • How to get select query for crystal report in c# code

    In C#, (Visual Studio 2008 ) I need to use the native Crystal Reports objects to get the complete SQL statement as it appears when you view it in Crystal Reports.
    In Crystal Reports 12.0, Go to "Database > Show SQL Query..." ... That is what I need to get via C# code. I can get bits and pieces of parameter info etc but I just want the whole SQL statement.
    How to get this?

    Hi Ganesh,
    It's simple to use RAS, include the assemblies and use this to open your report document:
    using CrystalDecisions.CrystalReports.Engine;
    using CrystalDecisions.Shared;
    using CrystalDecisions.ReportAppServer.ClientDoc;
    using CrystalDecisions.ReportAppServer.Controllers;
    using CrystalDecisions.ReportAppServer.ReportDefModel;
    using CrystalDecisions.ReportAppServer.DataSetConversion;
    using CrystalDecisions.ReportAppServer.DataDefModel;
            CrystalDecisions.CrystalReports.Engine.ReportDocument rpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
            ISCDReportClientDocument rptClientDoc;
    To open the report use:
         object rptName = openFileDialog.FileName;
                    rpt.Load(rptName.ToString());
                    rptClientDoc = rpt.ReportClientDocument;
    Then to get the SQL set the log on info:
                rptClientDoc.DatabaseController.LogonEx("10.50.212.77,1433", "xtreme", "sa", "password");
                GroupPath gp = new GroupPath();
                string tmp = String.Empty;
                rptClientDoc.RowsetController.GetSQLStatement(gp, out tmp);
                MessageBox.Show(tmp, "Data Source Set and SQL Statement", MessageBoxButtons.OK, MessageBoxIcon.Information);
    Thank you
    Don

Maybe you are looking for

  • Error while implementing quartz-1.8.4 in weblogic server

    Hi, I am working on a scenario wherein the BPEL process has to be triggered at a particular interval. For this, I followed a helpful url: https://blogs.oracle.com/sdhurjati/entry/ready_to_use_quartz_scheduler It is working fine. But before deploying

  • How can I get my new wireless keyboard and track pad set up?

    I just bought a new mac mini, wireless keyboard and trackpad. Do I still need a wired keyboard and mouse to get the thing set up? Trackpad seems to be working as I can move around the screen but I can't click where I need to click to move onto the ne

  • FICO Tables  G/L account group name  text

    Hai         I'm developing an Report  in ABAP , I would like to get the  G/L account group & its text , But am not getting account group text ,   G/L account group field is available  ( SKA1-KTOKS )  & ( T077S  Pooled  table , i could't find any TEXT

  • Signed code vs security manager

    i've seen tons of information on how to implement a security manager, and tons of information on signed code, but i haven't found information about WHY you choose with one over the other. we are implementing security is a very large desktop app.

  • Se me callo mi ipad y se puso  toda la pantalla azul

    se me callo mi ipad y sí Puso azul Toda la panta y no se que hacer