How to subract char with number

Hi Experts
Here is my requirement
select sysdate-1 from dual -- Goes to previous date sysdate formate is DD-MON-RRRR
Iam changing this format as MM-DD-RRRR
select to_char(sysdate, 'MM-DD-RRRR') From Dual -- Here now how can I go to my previous date with this?
I am trying this
select to_char(sysdate, 'MM-DD-RRRR') ,-1 From Dual -- here I am subtracting Char with no which is not possible how can i achieve this ?
Regards
Suresh Babu

subtract then convert:
select to_char(sysdate-1,'mm-dd-yyyy')
from dual;
TO_CHAR(SY
05-23-2013?
nb 'rr' only makes sense for 2-digit years.

Similar Messages

  • How to compare varchar with number

    i am doing one report for that am passing receipt number(from , to) as parameters
    if i compare for that table i am getting output.
    select receipt_num from rcv_shipment_headers rsh
    where to_number(rsh.receipt_num) between nvl(:P_RECEIPT_FROM,rsh.receipt_num) and nvl(:P_RECEIPT_TO,rsh.receipt_num)
    but when i am using in below query it is getting error "Invalid Number"
    select rsh.receipt_num
    , sum(rs.quantity)
    , rs.unit_of_measure
    , rct.transaction_date "Date of Entry"
    , pov.vendor_name
    , msi.segment1 "Item Code"
    , msi.description "Item Description"
    from rcv_transactions rct
    , rcv_shipment_headers rsh
    , rcv_shipment_lines rsl
    , po_vendors pov
    , mtl_system_items_b msi
    , rcv_supply rs
    where rsh.shipment_header_id=rct.shipment_header_id
    and rsh.shipment_header_id=rsl.shipment_header_id
    and rsl.shipment_line_id=rct.shipment_line_id
    and rsh.vendor_id=pov.vendor_id
    and rsl.item_id=msi.inventory_item_id
    and msi.organization_id=106
    and rsl.shipment_line_id=rct.shipment_line_id
    and rct.transaction_id=rs.rcv_transaction_id
    and to_number(rsh.receipt_num) between nvl(:P_RECEIPT_FROM,rsh.receipt_num) and nvl(:P_RECEIPT_TO,rsh.receipt_num)
    and rct.organization_id=nvl(:P_ORG_ID,rct.organization_id)
    and rsh.vendor_id=nvl(:P_Vendor_Name,rsh.vendor_id)
    and rct.inspection_status_code='NOT INSPECTED'
    group by rsh.receipt_num
    , rs.unit_of_measure
    , rct.transaction_date
    , pov.vendor_name
    , msi.segment1
    , msi.description
    plese help to solve
    Thanks & Regards
    Adina

    The problem lies here:
    and rsh.vendor_id=nvl(:P_Vendor_Name,rsh.vendor_id)How can you compare vendor_name with vendor_id????????????
    SQL> select * from po_vendors where vendor_id = NVL(&p_vendor_name,vendor_id);
    Enter value for p_vendor_name: 'AAAA'
    old   1: select * from po_vendors where vendor_id = NVL(&p_vendor_name,vendor_id)
    new   1: select * from po_vendors where vendor_id = NVL('AAAA',vendor_id)
    select * from po_vendors where vendor_id = NVL('AAAA',vendor_id)
    ERROR at line 1:
    ORA-01722: invalid number
    SQL> Message was edited by:
    user605919

  • How to replace name with number ID

    Example:
    Table1
    T1ID Name1
    1 John Smith
    2 Kathy Smith
    Table2
    T2ID Name2
    100 John Smith
    101 Kathy Smith
    102 John Smith
    103 Kathy Smith
    I want to replace all names in column called Name2 in Table 2, with matching T1ID from Table 1. There are many name repetitions in Table 2.

    If Name2 is VARCHAR and T1id is number then it would be better to add a new column with a consistent data type;
    Sample data;
    create table table1 as (
    select 1 t1id, 'John Smith' name1 from dual union all
    select 2, 'Kathy Smith'from dual);
    Table created
    alter table table1 add constraint table1_pk primary key (t1id);
    Table altered
    create table table2 as (
    select 100 t2id, 'John Smith' name2 from dual union all
    select 101, 'Kathy Smith' from dual union all
    select 102, 'John Smith' from dual union all
    select 103, 'Kathy Smith' from dual);
    Table createdAdd the new column;
    alter table table2
       add name_id references table1(t1id);
    Table alteredUpdate the new column;
    merge into table2 t2
    using (select t1id, name1
           from table1) t1
    on (t2.name2 = t1.name1)
    when matched then
      update
      set t2.name_id = t1.t1id;
    DoneDrop the retired column;
    alter table table2 drop column name2;
    Table altered
    select * from table2;
          T2ID    NAME_ID
           100          1
           101          2
           102          1
           103          2

  • Ho to Comapre with Number Data Type

    hi
    My reqt is to do validation in ValidateEntity Method.
    How to compare the with Number Data type:
    For ex: Number a = gatAbc();
    If(a>10)
    throw new oaExcption...
    But while comapring i got compiler Error
    Error(218,17): method >(oracle.jbo.domain.Number, int) not found in class abc.oracle.apps.per.irc.pqr.schema.server.XxabcEOImpl
    So plz tell me how to compare the integer value with Number data type
    Thanx

    Check with float. It will work definitely.
    float number = Float.parseFloat(HrsPerDay); //HrsPerDay is a String and I am converting it to float
    if(( number <= 0) || (number >= 21))
                            throw new OAAttrValException(OAAttrValException.TYP_VIEW_OBJECT,
                                              "xxCopyResourceVO1",
                                              rowi.getKey(),
                                              "NoOfCopies",
                                              rowi.getAttribute("NoOfCopies"),
                                              "PA",
                                              "xx_xx_COPY_POSITIVE_NUM");
                       }Here in this code i am also checking that the Hours cannot be less then 0 and greater than 20.
    Thanks
    --Anil                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • How can I convert a number to char in javascript

    How can I convert a number i.e ascii number to char in javascript.
    ex: 55 to A

    How can I convert a number i.e ascii number to char in javascript.
    Quite simple: By asking in a forum that deals with javascript and not with java.
    Have no clue...
    Maybe on http://www.irt.org

  • How do I use cell number associated with iPad 2 3G

    How do I use cell number associated with iPad 2 3G

    For Messages you can can use your email address, the iPad doesn't have a phone number that you can use.

  • I have an iphone4 and my husband merge his numbers with mine and i think it was deleted can you tell me how can he get his number back on his phone

    have an iphone4 and my husband merge his numbers with mine and i think it was deleted can you tell me how can he get his number back on his phone

    Do you possibly mean the contacts have been merged?
    If so, where are each of you syncing contacts?  A supported application on the computer? iCloud or another cloud service? An Exchange server?
    WIthout details, it's difficult to offer specific resolutions.

  • How to trace purchase order number with respect to Purchase requestion numb

    Hi friends,
    Can u please help me how to Trace purchase order number with respect to purchase Requetuion  number. Is there any standard report  available in R/3

    Hi Vamsi,
    Thats what!!!
    Goto SE16 - EBAN - Give PR number in the iput screen.
    In the output screen you will have to do field selection from Menu - Settings - formatlist - choose fields.
    There you choose Purchase Order.
    So the output will display for you POs for the PR that you entered.
    Regards,
    Vishal

  • How can I print the "number lines" with the code in Visual Studio?

    How can I print the "number lines" with the code in Visual Studio?

    Hi BillionaireMan,
    What about your issue now?
    If you have resolved it, you can share the solution here, which will be beneficial for other members with the same issue.
    If you did not, please tell us more information,we will try my best to help you.
    Best regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How can i print a list of bookmarks or extract bookmarks with number paper to print?

    How can i print a list of bookmarks or extract bookmarks with number paper to print?

    I have created a tool which can create a summary of the bookmarks structure of a file in either PDF format or as a plain text file, and you can also choose whether or not to include the matching page number for each bookmark. Have a look here: http://try67.blogspot.com/2008/11/acrobat-export-bookmarks-to-pdf-txt.html

  • HT204266 How do I purchase a number of apps at one time with just one credit card transaction?  I am traveling and I pay an overseas conversion fee each time I use my credit card.

    How do I purchase a number of apps at one time through iTunes using just one credit card transaction.  So far it seems that each app purchase is a separate transaction.  Is there a shopping cart facility?  I can't find one if there is. I'm traveling so each credit card transaction is quite costly.
    Thanks!
    Ruth

    I wish this were true.
    It is true.
    You will be billed for iTunes purchase exactly the same as if you are at home. The CC company will not add any fees.
    When purchasing through iTunes, it is NOT an overseas transaction. The transaction will simply show up as a regular transaction in your iTunes store. You will be charged/billed according to your address in iTunes, not where you physically are located.
    When you make a purchase in a shop, the retailer ID/location is sent with the transaction allowing the CC company to figure the exchange rates and bill the correct amount.

  • How do I delete a number of duplicate tunes with one operation?

    How do I delete a number of duplicate tunes with one operation?

    See here: https://discussions.apple.com/thread/3293239?start=0&tstart=0
    B-rock

  • How can I register a number with iMessage for my iPad2?

    I've got a 3G card with a mobile phone number. How can I register this number with iMessage?

    Good afternoon;
    So to confirm your posting,
    lllaass wrote:
    If it is a number/email address yu are calling:
    - Is it entered in a contact in your Contact app.
    - Does the person have the number/email address registered as their messaging number/emai addrrss.
    the other person needs to register thier information?

  • How to generate report with dynamic variable number of columns?

    How to generate report with dynamic variable number of columns?
    I need to generate a report with varying column names (state names) as follows:
    SELECT AK, AL, AR,... FROM States ;
    I get these column names from the result of another query.
    In order to clarify my question, Please consider following table:
    CREATE TABLE TIME_PERIODS (
    PERIOD     VARCHAR2 (50) PRIMARY KEY
    CREATE TABLE STATE_INCOME (
         NAME     VARCHAR2 (2),
         PERIOD     VARCHAR2 (50)     REFERENCES TIME_PERIODS (PERIOD) ,
         INCOME     NUMBER (12, 2)
    I like to generate a report as follows:
    AK CA DE FL ...
    PERIOD1 1222.23 2423.20 232.33 345.21
    PERIOD2
    PERIOD3
    Total 433242.23 56744.34 8872.21 2324.23 ...
    The TIME_PERIODS.Period and State.Name could change dynamically.
    So I can't specify the state name in Select query like
    SELECT AK, AL, AR,... FROM
    What is the best way to generate this report?

    SQL> -- test tables and test data:
    SQL> CREATE TABLE states
      2    (state VARCHAR2 (2))
      3  /
    Table created.
    SQL> INSERT INTO states
      2  VALUES ('AK')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('AL')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('AR')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('CA')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('DE')
      3  /
    1 row created.
    SQL> INSERT INTO states
      2  VALUES ('FL')
      3  /
    1 row created.
    SQL> CREATE TABLE TIME_PERIODS
      2    (PERIOD VARCHAR2 (50) PRIMARY KEY)
      3  /
    Table created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD1')
      3  /
    1 row created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD2')
      3  /
    1 row created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD3')
      3  /
    1 row created.
    SQL> INSERT INTO time_periods
      2  VALUES ('PERIOD4')
      3  /
    1 row created.
    SQL> CREATE TABLE STATE_INCOME
      2    (NAME   VARCHAR2 (2),
      3       PERIOD VARCHAR2 (50) REFERENCES TIME_PERIODS (PERIOD),
      4       INCOME NUMBER (12, 2))
      5  /
    Table created.
    SQL> INSERT INTO state_income
      2  VALUES ('AK', 'PERIOD1', 1222.23)
      3  /
    1 row created.
    SQL> INSERT INTO state_income
      2  VALUES ('CA', 'PERIOD1', 2423.20)
      3  /
    1 row created.
    SQL> INSERT INTO state_income
      2  VALUES ('DE', 'PERIOD1', 232.33)
      3  /
    1 row created.
    SQL> INSERT INTO state_income
      2  VALUES ('FL', 'PERIOD1', 345.21)
      3  /
    1 row created.
    SQL> -- the basic query:
    SQL> SELECT   SUBSTR (time_periods.period, 1, 10) period,
      2             SUM (DECODE (name, 'AK', income)) "AK",
      3             SUM (DECODE (name, 'CA', income)) "CA",
      4             SUM (DECODE (name, 'DE', income)) "DE",
      5             SUM (DECODE (name, 'FL', income)) "FL"
      6  FROM     state_income, time_periods
      7  WHERE    time_periods.period = state_income.period (+)
      8  AND      time_periods.period IN ('PERIOD1','PERIOD2','PERIOD3')
      9  GROUP BY ROLLUP (time_periods.period)
    10  /
    PERIOD             AK         CA         DE         FL                                             
    PERIOD1       1222.23     2423.2     232.33     345.21                                             
    PERIOD2                                                                                            
    PERIOD3                                                                                            
                  1222.23     2423.2     232.33     345.21                                             
    SQL> -- package that dynamically executes the query
    SQL> -- given variable numbers and values
    SQL> -- of states and periods:
    SQL> CREATE OR REPLACE PACKAGE package_name
      2  AS
      3    TYPE cursor_type IS REF CURSOR;
      4    PROCEDURE procedure_name
      5        (p_periods   IN     VARCHAR2,
      6         p_states    IN     VARCHAR2,
      7         cursor_name IN OUT cursor_type);
      8  END package_name;
      9  /
    Package created.
    SQL> CREATE OR REPLACE PACKAGE BODY package_name
      2  AS
      3    PROCEDURE procedure_name
      4        (p_periods   IN     VARCHAR2,
      5         p_states    IN     VARCHAR2,
      6         cursor_name IN OUT cursor_type)
      7    IS
      8        v_periods          VARCHAR2 (1000);
      9        v_sql               VARCHAR2 (4000);
    10        v_states          VARCHAR2 (1000) := p_states;
    11    BEGIN
    12        v_periods := REPLACE (p_periods, ',', ''',''');
    13        v_sql := 'SELECT SUBSTR(time_periods.period,1,10) period';
    14        WHILE LENGTH (v_states) > 1
    15        LOOP
    16          v_sql := v_sql
    17          || ',SUM(DECODE(name,'''
    18          || SUBSTR (v_states,1,2) || ''',income)) "' || SUBSTR (v_states,1,2)
    19          || '"';
    20          v_states := LTRIM (SUBSTR (v_states, 3), ',');
    21        END LOOP;
    22        v_sql := v_sql
    23        || 'FROM     state_income, time_periods
    24            WHERE    time_periods.period = state_income.period (+)
    25            AND      time_periods.period IN (''' || v_periods || ''')
    26            GROUP BY ROLLUP (time_periods.period)';
    27        OPEN cursor_name FOR v_sql;
    28    END procedure_name;
    29  END package_name;
    30  /
    Package body created.
    SQL> -- sample executions from SQL:
    SQL> VARIABLE g_ref REFCURSOR
    SQL> EXEC package_name.procedure_name ('PERIOD1,PERIOD2,PERIOD3','AK,CA,DE,FL', :g_ref)
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    PERIOD             AK         CA         DE         FL                                             
    PERIOD1       1222.23     2423.2     232.33     345.21                                             
    PERIOD2                                                                                            
    PERIOD3                                                                                            
                  1222.23     2423.2     232.33     345.21                                             
    SQL> EXEC package_name.procedure_name ('PERIOD1,PERIOD2','AK,AL,AR', :g_ref)
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    PERIOD             AK         AL         AR                                                        
    PERIOD1       1222.23                                                                              
    PERIOD2                                                                                            
                  1222.23                                                                              
    SQL> -- sample execution from PL/SQL block
    SQL> -- using parameters derived from processing
    SQL> -- cursors containing results of other queries:
    SQL> DECLARE
      2    CURSOR c_period
      3    IS
      4    SELECT period
      5    FROM   time_periods;
      6    v_periods   VARCHAR2 (1000);
      7    v_delimiter VARCHAR2 (1) := NULL;
      8    CURSOR c_states
      9    IS
    10    SELECT state
    11    FROM   states;
    12    v_states    VARCHAR2 (1000);
    13  BEGIN
    14    FOR r_period IN c_period
    15    LOOP
    16        v_periods := v_periods || v_delimiter || r_period.period;
    17        v_delimiter := ',';
    18    END LOOP;
    19    v_delimiter := NULL;
    20    FOR r_states IN c_states
    21    LOOP
    22        v_states := v_states || v_delimiter || r_states.state;
    23        v_delimiter := ',';
    24    END LOOP;
    25    package_name.procedure_name (v_periods, v_states, :g_ref);
    26  END;
    27  /
    PL/SQL procedure successfully completed.
    SQL> PRINT g_ref
    PERIOD             AK         AL         AR         CA         DE         FL                       
    PERIOD1       1222.23                           2423.2     232.33     345.21                       
    PERIOD2                                                                                            
    PERIOD3                                                                                            
    PERIOD4                                                                                            
                  1222.23                           2423.2     232.33     345.21                       

  • How do I speak with customer support if I don't know my serial number?

    Customer support won't let me chat or call until I list my serial number for my computer. I don't have it with me right now but would still like to speak with them.  Any thoughts?

    I hate to state the obvious but get your serial number then call them.
    How to find the serial number of your Apple hardware product

Maybe you are looking for

  • Time machine issues after HD upgrade

    I replaced and upgraded my internal HD today in my MacBook Pro (OSX 10.6.5). I restored OSX from my time machine backup to this new drive. However, when I next tried to run Time Machine, it tried to back everything up on the new drive, which is about

  • Balance in Reco.A/c 1.46 mill.AED but the S_ALR_87012172 report is nil

    Hello, There is a 1.46 million AED balance in the Down payments recon a/c - Intercompany (AR) account but the S_ALR_87012172 (Customer balance in local currency)report with this reconciliation account shows as nil balance,we want the break up of this

  • Issues syncing photos to the new iPad

    I just got the new iPad and wanted to transfer all my pictures and videos from my windows 7 toshiba laptop. I connected with the setting sync all photos including video checked. The sync wouldn't transfer all photos and kept missing one album and non

  • Too much memory used ,nothing boots up after password .Help!

    I am having trouble after I enter my password the screen gets stuck on the login picture of stars .i have a low memory warning pop up when I enter my password . Is there any way I can fix this ?

  • Experiencing problems download OS X updates

    Hi As anyone been experiencing issue download from the AppStore, software updates to OS X Mountain Lion; go to update but keep getting an error has occurred (The operation couldn't e completed.  (NSURLErrorDomain error - 3001.)(102).  What ever that