Oracle date function to add one second

how to add one second to the date, example, SYSDATE+1 will add one day to current day, but how to add one second to the current time. for example, the current date is "2006-4-21 12:01:12", and I want to add 1 second to the current time, and the result will be "2006-4-21 12:01:13", how to achieve it??

select to_char(sysdate,'hh24:mi:ss'),
to_char(sysdate+1/24/60/60,'hh24:mi:ss') from dual;
TO_CHAR( TO_CHAR(
09:44:44 09:44:45

Similar Messages

  • How to add one second to a date time stamp

    What is the proper syntax to add one second to a date/timestamp?

    Just think about it.
    24 hours in a day, 60 mins per hour and 60 second per minute
    total of 86400 seconds per day.
    So, you add 1/86400 to the date/timestamp column
    e.g. select my_date + (1/86400) from my_table;
    What is the proper syntax to add one second to a date/timestamp?

  • Infocube and ODS populated with DATA (need to add one more field?)

    Hi,
      If infocube and ODS have been populated with data for past 3 months. Then we need to add one more field to this cube. What is the impact? Please advise.
    The following is my understanding. Please correct me if I am wrong.
    1) Need to delete content of ODS and infocube.
    2) insert the new field at ODS and infocube.
    3) reload the data into ODS and infocube.
    Is there a way that the current data need not be deleted.
    Just add in this new field and only subsequent month, infocube will have this new field? Please advise what is the best approach without affecting existing data.

    Hi,
    Siggi is right. You dont need to delete the previously loaded data to CUBE or ODS. The only catch is that, your new field will be empty as far as history is concerned. But so long as you did map it to the datasource and the datasource is able to fill it up, then your new field will now have value for incoming DELTA Updates.
    Addition of a field is not that complicated compared to deletion of a field from CUBE or ODS.
    --Jkyle

  • Oracle Date function.

    Hi Team,
    I have a table with date column (16/06/1996 15:03:59) as value in the displayed format.
    As I have tried with the below query format I could n't able to retrive the records.
    select * from <table> where DATE_INSERT=SYSDATE;
    Could you please help to retrive the rows for the tables ?
    Regards,
    Augustine

    Hi, Augustine,
    Do you want to find rows where the year, month and day of date_insert are the same as the year, month and day of SYSDATE, regardless of what the hours, minutes and seconds of each are?
    If so:
    SELECT *
    FROM table_x
    WHERE date_insert >= TRUNC (SYSDATE)
    AND date_insert < TRUNC (SYSDATE) + 1
    This query above is more efficient than the following:
    SELECT *
    FROM table_x
    WHERE TRUNC (date_insert) = TRUNC (SYSDATE) -- *** BAD ***
    (although they get the same results) because it only  has to call the TRUNC function 2 times, no matter how many rows are in the table.  If you have 1,000,000 rows in the table, the 2nd query has to call TRUNC 1,000,002 times.  Potentially more important, the 1st query allows the optimizer to use an index on date_insert.

  • Oracle date function help

    Hi all,
    I need to write a function below scenario
    I need to pass two parameters from_date and to_date
    i want to get all dates between from_date and to_date except Saturdays and include from_date and to_date also.
    Please help me.
    Thanks,
    Edited by: carmac on Jan 29, 2013 5:04 PM

    Check in plain SQL.. Enter the dates inthe format YYYYMMDD
    WITH t AS
            (SELECT TO_DATE (:dt1, 'YYYYMMDD') startdt,
                    TO_DATE (:dt2, 'YYYYMMDD') enddt
               FROM DUAL)
    SELECT *
      FROM (    SELECT DECODE (TO_CHAR (startdt + ROWNUM, 'DY'),
                               'SAT', NULL,
                               startdt + ROWNUM)
                          dt
                  FROM t
            CONNECT BY ROWNUM <= (enddt - startdt))
    WHERE dt IS NOT NULL;PL/SQL approach (Function):---
    CREATE TYPE t_dt AS OBJECT
           (dt DATE);
    CREATE TYPE t_dt_tbl IS TABLE OF t_dt;
    CREATE OR REPLACE FUNCTION fn_ret_dts_no_sat (p_dt1 varchar2, p_dt2 varchar2)
       RETURN t_dt_tbl
       PIPELINED AS
    BEGIN
       FOR rec
          IN (WITH t AS
                      (SELECT TO_DATE (p_dt1, 'YYYYMMDD') startdt,
                              TO_DATE (p_dt2, 'YYYYMMDD') enddt
                         FROM DUAL)
              SELECT *
                FROM (    SELECT DECODE (TO_CHAR (startdt + ROWNUM, 'DY'),
                                         'SAT', NULL,
                                         startdt + ROWNUM)
                                    dt
                            FROM t
                      CONNECT BY ROWNUM <= (enddt - startdt))
               WHERE dt IS NOT NULL) LOOP
          PIPE ROW (t_dt (rec.dt));
       END LOOP;
       RETURN;
    END;
    /Testing:
    select * from table(fn_ret_dts_no_sat('20120101','20120131'));Output:
    DT
    1/2/2012
    1/3/2012
    1/4/2012
    1/5/2012
    1/6/2012
    1/8/2012
    1/9/2012
    1/10/2012
    1/11/2012
    1/12/2012
    1/13/2012
    1/15/2012
    1/16/2012
    1/17/2012
    1/18/2012
    1/19/2012
    1/20/2012
    1/22/2012
    1/23/2012
    1/24/2012
    1/25/2012
    1/26/2012
    1/27/2012
    1/29/2012
    1/30/2012
    1/31/2012Cheers,
    Manik.
    Edited by: Included Function approach.

  • How to get no of days using oracle date function

    Dear all,
    i need different output from this query mentioned below.
    suppose i have execute this query.
    sql> select add_month(SYSDATE, -1 * 6) finaldate from dual;
    it will give the output as
    sql>FINALDATE
    05-JUL-2009 13:46
    now i need to get the total no days from the same query that means it should calculate the total no of days from july to current date and give the output.
    if you can give any hint.
    Regards
    Laxman

    Oracle supports date arithmetic and uses day as a unit.For example, number of days from July 1, 2009 to SYSDATE
    SQL> SELECT  SYSDATE - DATE '2009-07-01'
      2    FROM  DUAL
      3  /
    SYSDATE-DATE'2009-07-01'
                  188.386968
    SQL> SY.

  • Add 1 Second to the specified date

    Hi ,
    I have a date like "20061021 22:12:60".
    I need to add one second to this date string. Can you please tell me how to do it. I used SimpleDateFormat , but don't know how to add .
    If it is a Calender instance, i can add one sec.
    any ideas or sample code is fine.
    Thanks.

    I have a date like "20061021 22:12:60".As you noted correctly, this is not a date, this is a String. Just a bunch of chars.
    I need to add one second to this date string. Can
    you please tell me how to do it. I used
    SimpleDateFormat , but don't know how to add .Get the Date you parsed, get its time long, add 1000, be done.
    If it is a Calender instance, i can add one sec. You can set a Calendar to a certain Date. Did you read the API?

  • XSLT Mapping: how to add one day to TimeStamp

    Hello Experts,
    My requirement is to add one day to current timestamp. Used $TimeSent to get the currenttimestamp. In Expired field, the need to add one day
    say Created= 2011-03-30T20:29:13Z
           Expired = 2011-03-31T20:29:13Z
         <xsl:param name="TimeSent"/>
         <created><xsl:value-of select="$TimeSent"/></created>
         <expired>2011-03-31T20:29:13Z</expired>
    How to add one day to the current timestamp. I am new to XSLT mapping and need some help with the code.
    Thanks
    Shikha Jain
    Edited by: Jain Shikha on Mar 30, 2011 8:34 PM
    Edited by: Jain Shikha on Mar 30, 2011 8:36 PM

    Hello All,
    Thanks for your reply. i tried the function and the code is working when i am testing in stylus studio. But the same code gives error when i  tested the xslt mapping in PI (Error: TransformerConfigurationException triggered while loading XSLT mapping).
    $TimeSent function is working when code is tested in PI , but it doesnot give value in stylus studio. Also Current-dateTime() function is doesnot give value in PI but works in stylus studio. Is there any difference in the functions used in stylus studio and XSLT mapping in PI?
    Also if i remove the code used for function(to add one day to timestamp), and use constant value(2011-04-02T23:24:56.763Z)the code is working fine in PI. Please help me to find out where the code is going wrong when tested in PI.
    Below is the XSLT code i am using
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ds="http://xsltsl.org/date-time" xmlns:functx="http://www.functx.com" xmlns:xs="http://www.w3.org/2001/XMLSchema">
       <xsl:function name="functx:next-day" as="xs:date?">
          <xsl:param name="TimeSent" as="xs:anyAtomicType?"/>
          <xsl:sequence select="xs:date(current-date()) + xs:dayTimeDuration(&apos;P1D&apos;) "/>
       </xsl:function> 
    <xsl:template match="/">
          <xsl:param name="TimeSent"/>
          <soapenv:Envelope xmlns:olsa="http://www.skillsoft.com/services/olsa_v1_0/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
             <soapenv:Header>
                <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
                   <wsu:Timestamp wsu:Id="Timestamp-191900" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
            <wsu:Created>
                         <xsl:value-of select="$TimeSent"/>
               </wsu:Created>
    <wsu:Expires>
         <xsl:value-of select="concat(substring(functx:next-day($TimeSent) ,1,10) ,&apos;T&apos;, current-time())"/>                  </wsu:Expires>
                   </wsu:Timestamp>
                   <wsse:UsernameToken wsu:Id="UsernameToken-19030197" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
                      <wsse:Username>ABC</wsse:Username>
                      <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">XYZ</wsse:Password>
                      <wsse:Nonce>erDTBNoUWv7GdHDaErrLwA==</wsse:Nonce>
                      <wsu:Created>2011-02-15T23:24:56.763Z</wsu:Created>
                   </wsse:UsernameToken>
                </wsse:Security>
             </soapenv:Header>
             <soapenv:Body>
                <olsa:GetMultiActionSignOnUrlRequest>
                   <olsa:customerId>ABC</olsa:customerId>
                   <olsa:userName>XYZ</olsa:userName>
                   <olsa:actionType>launch</olsa:actionType>
                   <olsa:assetId>222499_eng</olsa:assetId>
                   <olsa:groupCode>testgrp</olsa:groupCode>
                </olsa:GetMultiActionSignOnUrlRequest>
             </soapenv:Body>
          </soapenv:Envelope>
       </xsl:template>
    </xsl:stylesheet>
    Thanks
    Shikha Jain
    Edited by: Jain Shikha on Apr 2, 2011 9:51 PM

  • From where to download the The Oracle Data Mining sample programs for DB11g

    In the Administrator's Guide to Oracle Data Mining 11g. One of the steps is to install the the Oracle Data Mining sample programs, which, according to the author, is included in the Oracle Database Companion. The author did not specify from where to download neither the sample programs nor the database companion CD/DVD!
    I would be grateful if you could provide me with the URL that has the required download.
    Regards,

    You should be able to download ODM DB11g sample programs from the following OTN link:
    http://www.oracle.com/technology/software/products/database/oracle11g/111060_win32soft.html
    Choose 'Oracle Database 11g Examples (formerly Companion)'

  • Oracle Dates & Working Days

    Hi,
    Is there an Oracle date function that ignores public bank holidays and calculates working days only?

    On the Internet, there is something called 'Google'. It can be used by anyone.
    I just used it for your request and got 569.000 hits.
    Sybrand Bakker
    Senior Oracle DBA

  • How can i add one month to a date variable ?

    Unlike the week which always 7 days, month may change from 28 to
    31, so how can i add one month to a date variable ? Thanks in
    advance.

    Adding 365 won't always work because of leap years.
    You could use the following SQL statement:
    SELECT
         TO_DATE(
              TO_CHAR(TO_DATE(SYSDATE), 'DD-MON-') ||
                (TO_CHAR(TO_DATE(SYSDATE), 'YYYY') + 1)) NEXT_YEAR
    FROM
         dual
    NEXT_YEAR
    08-JAN-03Or you could create your own function. You would use this
    exactly like add_months:
    CREATE OR REPLACE FUNCTION add_years
         (v_date DATE, num_years NUMBER)
    RETURN DATE AS
         v_year DATE;
    BEGIN
         v_year := TO_DATE(
                   TO_CHAR(TO_DATE(SYSDATE), 'DD-MON-') ||
                         (TO_CHAR(TO_DATE(SYSDATE), 'YYYY')
                                             + num_years));
         RETURN v_year;
    END;     
    SELECT
         add_years(SYSDATE, 1) new_year
    FROM
         dual
    NEW_YEAR 
    08-JAN-03
    SELECT
         add_years(SYSDATE, -1) new_year
    FROM
         dual
    NEW_YEAR 
    08-JAN-01

  • Oracle Data Mining - How to use PREDICTION function with a regression model

    I've been searching this site for Data Mining Q&A specifically related to prediction function and I wasn't able to find something useful on this topic. So I hope that posting it as a new thread will get useful answers for a beginner in oracle data mining.
    So here is my issue with prediction function:
    Given a table with 17 weeks of sales for a given product, I would like to do a forecast to predict the sales for the week 18th.
    For that let's start preparing the necessary objects and data:
    CREATE TABLE T_SALES
    PURCHASE_WEEK DATE,
    WEEK NUMBER,
    SALES NUMBER
    SET DEFINE OFF;
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('11/27/2010 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 1, 55488);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('12/04/2010 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 2, 78336);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('12/11/2010 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 3, 77248);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('12/18/2010 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 4, 106624);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('12/25/2010 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 5, 104448);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('01/01/2011 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 6, 90304);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('01/08/2011 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 7, 44608);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('01/15/2011 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 8, 95744);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('01/22/2011 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 9, 129472);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('01/29/2011 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 10, 110976);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('02/05/2011 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 11, 139264);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('02/12/2011 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 12, 87040);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('02/19/2011 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 13, 47872);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('02/26/2011 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 14, 120768);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('03/05/2011 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 15, 98463.65);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('03/12/2011 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 16, 67455.84);
    Insert into T_SALES
    (PURCHASE_WEEK, WEEK, SALES)
    Values
    (TO_DATE('3/19/2011 23:59:59', 'MM/DD/YYYY HH24:MI:SS'), 17, 100095.66);
    COMMIT;
    There are a lot of linear regression models and approaches for sales forecast out on the market, however I will focus on what oracle 11g offers i.e. package SYS.DBMS_DATA_MINING to create a model using regression as mining function and then, once the model is created, to apply prediction function on the model.
    Therefore I'll have to go through few steps:
    i) normalization of data
    CREATE OR REPLACE VIEW t_sales_norm AS
    SELECT week,
    sales,
    (sales - 91423.95)/27238.3693126778 sales_norm
    FROM t_sales;
    whereas the numerical values are the mean and the standard deviation:
    select avg(sales) from t_sales;
    91423.95
    select stddev(sales) from t_sales;
    27238.3693126778
    ii) auto-correlation. For the sake of simplicity, I will safely assume that there is no auto-correlation (no repetitive pattern in sales among the weeks). Therefore to define the lag data I will consider the whole set:
    CREATE OR REPLACE VIEW t_sales_lag AS
    SELECT a.*
    FROM (SELECT week,
    sales,
    LAG(sales_norm, 1) OVER (ORDER BY week) L1,
    LAG(sales_norm, 2) OVER (ORDER BY week) L2,
    LAG(sales_norm, 3) OVER (ORDER BY week) L3,
    LAG(sales_norm, 4) OVER (ORDER BY week) L4,
    LAG(sales_norm, 5) OVER (ORDER BY week) L5,
    LAG(sales_norm, 6) OVER (ORDER BY week) L6,
    LAG(sales_norm, 7) OVER (ORDER BY week) L7,
    LAG(sales_norm, 8) OVER (ORDER BY week) L8,
    LAG(sales_norm, 9) OVER (ORDER BY week) L9,
    LAG(sales_norm, 10) OVER (ORDER BY week) L10,
    LAG(sales_norm, 11) OVER (ORDER BY week) L11,
    LAG(sales_norm, 12) OVER (ORDER BY week) L12,
    LAG(sales_norm, 13) OVER (ORDER BY week) L13,
    LAG(sales_norm, 14) OVER (ORDER BY week) L14,
    LAG(sales_norm, 15) OVER (ORDER BY week) L15,
    LAG(sales_norm, 16) OVER (ORDER BY week) L16,
    LAG(sales_norm, 17) OVER (ORDER BY week) L17
    FROM t_sales_norm) a;
    iii) choosing the training data. Again, I will choose the whole set of 17 weeks, as for this discussion in not relevant how big should be the set of training data.
    CREATE OR REPLACE VIEW t_sales_train AS
    SELECT week, sales,
    L1, L2, L3, L4, L5, L6, L7, L8, L9, L10,
    L11, L12, L13, L14, L15, L16, L17
    FROM t_sales_lag a
    WHERE week >= 1 AND week <= 17;
    iv) build the model
    -- exec SYS.DBMS_DATA_MINING.DROP_MODEL('t_SVM');
    BEGIN
    sys.DBMS_DATA_MINING.CREATE_MODEL( model_name => 't_SVM',
    mining_function => dbms_data_mining.regression,
    data_table_name => 't_sales_train',
    case_id_column_name => 'week',
    target_column_name => 'sales');
    END;
    v) finally, where I am confused is applying the prediction function against this model and making sense of the results.
    On a search on Google I found 2 ways of applying this function to my case.
    One way is the following:
    SELECT week, sales,
    PREDICTION(t_SVM USING
    LAG(sales,1) OVER (ORDER BY week) as l1,
    LAG(sales,2) OVER (ORDER BY week) as l2,
    LAG(sales,3) OVER (ORDER BY week) as l3,
    LAG(sales,4) OVER (ORDER BY week) as l4,
    LAG(sales,5) OVER (ORDER BY week) as l5,
    LAG(sales,6) OVER (ORDER BY week) as l6,
    LAG(sales,7) OVER (ORDER BY week) as l7,
    LAG(sales,8) OVER (ORDER BY week) as l8,
    LAG(sales,9) OVER (ORDER BY week) as l9,
    LAG(sales,10) OVER (ORDER BY week) as l10,
    LAG(sales,11) OVER (ORDER BY week) as l11,
    LAG(sales,12) OVER (ORDER BY week) as l12,
    LAG(sales,13) OVER (ORDER BY week) as l13,
    LAG(sales,14) OVER (ORDER BY week) as l14,
    LAG(sales,15) OVER (ORDER BY week) as l15,
    LAG(sales,16) OVER (ORDER BY week) as l16,
    LAG(sales,17) OVER (ORDER BY week) as l17
    ) pred
    FROM t_sales a;
    WEEK, SALES, PREDICTION
    1, 55488, 68861.084076412
    2, 78336, 104816.995823913
    3, 77248, 104816.995823913
    4, 106624, 104816.995823913
    As you can see for the first row there is a value of 68861.084 and for the rest of 16 values is always one and the same 104816.995.
    Question: where is my week 18 prediction ? or maybe I should say which one is it ?
    Another way of using prediction even more confusing is against the lag table:
    SELECT week, sales,
    PREDICTION(t_svm USING a.*) pred
    FROM t_sales_lag a;
    WEEK, SALES, PREDICTION
    1, 55488, 68861.084076412
    2, 78336, 75512.3642096908
    3, 77248, 85711.5003385927
    4, 106624, 98160.5009687461
    Each row out of 17, its own 'prediction' result.
    Same question: which one is my week 18th prediction ?
    Thank you very much for all help that you can provide on this matter.
    It is as always highly appreciated.
    Serge F.

    Kindly let me know how to give input to predict the values for example script to create model is as follows
    drop table data_4svm
    drop table svm_settings
    begin
    dbms_data_mining.drop_model('MODEL_SVMR1');
    CREATE TABLE data_4svm (
    id NUMBER,
    a NUMBER,
    b NUMBER
    INSERT INTO data_4svm VALUES (1,0,0);
    INSERT INTO data_4svm VALUES (2,1,1);
    INSERT INTO data_4svm VALUES (3,2,4);
    INSERT INTO data_4svm VALUES (4,3,9);
    commit;
    --setting table
    CREATE TABLE svm_settings
    setting_name VARCHAR2(30),
    setting_value VARCHAR2(30)
    --settings
    BEGIN
    INSERT INTO svm_settings (setting_name, setting_value) VALUES
    (dbms_data_mining.algo_name, dbms_data_mining.algo_support_vector_machines);
    INSERT INTO svm_settings (setting_name, setting_value) VALUES
    (dbms_data_mining.svms_kernel_function, dbms_data_mining.svms_linear);
    INSERT INTO svm_settings (setting_name, setting_value) VALUES
    (dbms_data_mining.svms_active_learning, dbms_data_mining.svms_al_enable);
    COMMIT;
    END;
    --create model
    BEGIN
    DBMS_DATA_MINING.CREATE_MODEL(
    model_name => 'Model_SVMR1',
    mining_function => dbms_data_mining.regression,
    data_table_name => 'data_4svm',
    case_id_column_name => 'ID',
    target_column_name => 'B',
    settings_table_name => 'svm_settings');
    END;
    --to show the out put
    select class, attribute_name, attribute_value, coefficient
    from table(dbms_data_mining.get_model_details_svm('MODEL_SVMR1')) a, table(a.attribute_set) b
    order by abs(coefficient) desc
    -- to get predicted values (Q1)
    SELECT PREDICTION(MODEL_SVMR1 USING *
    ) pred
    FROM data_4svm a;
    Here i am not sure how to predict B values . Please suggest the proper usage . Moreover In GUI (.NET windows form ) how user can give input and system can respond using the Q1

  • How can i add one wave in in our Function generator example?

    how can i add one anotehr wave in our function generator example. i want to use superposition and add one more wave to our first wave in function generator and see the result.thanks

    Hi hood1,
    2 options:
    1) You can add many waveforms by combining them into one Array.
    2) Use the Waveforms tools, that give you many option for adding waveforms. one after the seconed or adding the Y array of a waveform to other Y array of second wave form, and so on...
    Hope it Helps...

  • Oracle 9i function to perform data manipulation

    Hi everyone,
    I have two scenarios. I would like to write one Oracle 9i function that can accommodate both these scenarios, using PL/SQL developer. I intend passing a varchar2 parameter to this function. Within the function, I perform a select on a table and see if this value sent has a parent record.
    If it does not have a parent record (null or blank) then I take this value, join with another table, perform some processing and return one varchar2 value.
    If it has a parent record (not null or not blank) then I need to retrieve all the other children records associated with this same parent record, take this value, join with another table,perform some processing and return one varchar2 value.
    I have two simple queries that I wrote: one for record with null/blank parent, and the other for record with same parent and other children. These two queries work individually, when I combine them is where I run into problems. Sample table:
    TABLE XYZ data: (note: if there is a parent, parent shows up in both parent and child field in the table)
    child parent
    1234
    5107 3167
    6259 3652
    5678 9754
    3167 3167
    3652 3652
    1649
    2306 9754
    4657 3652
    9754 9754
    8753 3652
    passing record 1234 into the function.
    SELECT A.child, A.parent, C.field1
    FROM OTHERTABLE C,
    (SELECT TableA.child, TableA.parent
    FROM XYZ TableA
    WHERE TableA.child ='1234')A
    WHERE A.child = C.field2
    ----(output of this query is 1 record with 3 fields 1234 and null/blank and 987654321. I place this output into a cursor and then take 987654321 and place into a variable and return this value)
    passing record 4657 into the function
    SELECT c.CHILDfield, c.PARENTfield, TableOther.field1
    FROM OTHERTABLE TableOther,(
    (SELECT B.CHILDfield, B.PARENTfield FROM
    (SELECT A.PARENTfield, i.CHILDfield FROM TableB,
    (SELECT TableA.CHILDfield, TableA.PARENTfield
    FROM XYZ TableA
    WHERE TableA.CHILDfield ('4657' ))A
    -- pass 4657 and then get the parent
    WHERE A.PARENTfield = TableB.PARENTfield)B
    -- gets associated children with the parent from previous query.
    -- note: parent can exist in the parent and child fields
    WHERE B.CHILDfield <> B.PARENTfield))C
    --strips off the parent and gets child/children only as I don't need
    --the parent when it is also a child
    WHERE C.CHILDfield = TableOther.field1
    --(output of this query is 3 records
    4657 3652 912345671
    6259 3652 945362798
    8753 3652 934274857)
    I place this output into a cursor and then have a CASE statement that goes thru each record, and appends the third value into a variable, the ultimate return value of this will be as follows:
    912345671;945362798;934274857)
    The dilemma is writing a generic query to accommodate both these situations. My current function can handle each of these situations individually, but not both. For testing purposes, I change the select statement depending on whether I have a record that has a parent on not!
    Any help is greatly appreciated.

    You want one function to handle two cases? This is the best opportunity to use the IF STATEMENT.
    FUNCTION MyFunc (p_input IN VARCHAR2) RETURN VARCHAR2 IS
    ReturnValue VARCHAR2;
    BEGIN
    IF <blank or null test> THEN
    SELECT ... -- Blank or null select statement
    ... -- Blank or null data processing
    RETURN ReturnValue;
    ELSE
    SELECT ... -- Other select statement
    ... -- Other data processing
    RETURN ReturnValue;
    END IF;
    END MyFunc;

  • Raw to date function in oracle

    Hi..
    I would like to know the details and usage of Raw to date function in oracle database.Could some one let me know the function details?

    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> set serveroutput on
    SQL> DECLARE
      2   rv RAW(32) := '786B060818023A';
      3   dt DATE := NULL;
      4  BEGIN
      5    dbms_stats.convert_raw_value(rv, dt);
      6    dbms_output.put_line(TO_CHAR(dt, 'DD-MON-YYYY'));
      7  END;
      8  /
    08-JUN-2007
    PL/SQL procedure successfully completed.
    SQL>Regards,
    Jo
    PS: This is not my own example. I don't recollect the link I got this example from. Will post the link if I come across it again. I think its www.psoug.org (not sure)

Maybe you are looking for

  • Auto PO Creation from GR Posting

    Dear all, I setup PO creation automatically when GR w/o PO using movement type 101.  All data is fine but PO number can't be assigned by internal number assigned.  It displayed "Please specify an external number range" Message no NR753.  Please kindl

  • EOFException in ReadUTF. Please help!!

    Hi, I�m reading a string sent by a servlet to a middlet, using ReadUTF. In a fist moment it worked, by now it throws a java.io.EOFException, I don�t know why, I think I�ve modified anything. The midlet receive string code is:            httpConn = (H

  • Upgrade UCM9.1.2

            Hello, Iam doing an upgrade from 7.1.5 to 9.1.2, since the system are in production, we build a parallel 7.1 publisher in VM (Linux4, 4G,160GB HDD)and restored the backup from the production system succesfully.  After that i had upload a demo

  • Oracle 10.2.0.4 Bin file

    Hi I have downloaded the patchset 10.2.0.4 from the marketplace MS Windows x86-64 (64-bit) /Oracle/Oracle 10.2.0.4/Database RDBMS/MS Windows x86-64 (64-bit) Patchset_10204_MSWIN-x86-64aa.bin Patchset_10204_MSWIN-x86-64ab.bin Patchset_10204_MSWIN-x86-

  • Export Model to local filesystem

    Hello, when I export a model I can't change the filename, the field is read-only (we don't uses NWDI). The ZIP-File will created in the filesystem of the CE-System. There's no way to export the model to the local filesystem (e.g. c:\test. ...). In VC