How to insert decimal point while selecting data from a table

Hi All ,
My select requirement says , If the value received with no decimal then insert decimal before last 2 bytes. I need to retrieve data with this condition.
May you people help how i can achieve this?
Thanks in advance,
Sachetan

Is the data a number in string format?
with q as (select '12345' myNum from dual
union all select '45.78' from dual)
select case when instr(myNum, '.') > 0 then to_number(myNum) else
       to_number(substr(myNum, 1, length(myNum) - 2) || '.' ||
                substr(myNum, length(myNum) - 1)) end newNum from q
NEWNUM
123.45
45.78If not just use
with q as (select 12345 myNum from dual
union all select 45.78 from dual)
select case
when instr(myNum,'.')>0 then myNum
else myNum/100
end myNum
from q
MYNUM
123.45
45.78

Similar Messages

  • Error while selecting date from external table

    Hello all,
    I am getting the follwing error while selecting data from external table. Any idea why?
    SQL> CREATE TABLE SE2_EXT (SE_REF_NO VARCHAR2(255),
      2        SE_CUST_ID NUMBER(38),
      3        SE_TRAN_AMT_LCY FLOAT(126),
      4        SE_REVERSAL_MARKER VARCHAR2(255))
      5  ORGANIZATION EXTERNAL (
      6    TYPE ORACLE_LOADER
      7    DEFAULT DIRECTORY ext_tables
      8    ACCESS PARAMETERS (
      9      RECORDS DELIMITED BY NEWLINE
    10      FIELDS TERMINATED BY ','
    11      MISSING FIELD VALUES ARE NULL
    12      (
    13        country_code      CHAR(5),
    14        country_name      CHAR(50),
    15        country_language  CHAR(50)
    16      )
    17    )
    18    LOCATION ('SE2.csv')
    19  )
    20  PARALLEL 5
    21  REJECT LIMIT UNLIMITED;
    Table created.
    SQL> select * from se2_ext;
    SQL> select count(*) from se2_ext;
    select count(*) from se2_ext
    ERROR at line 1:
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-04043: table column not found in external source: SE_REF_NO
    ORA-06512: at "SYS.ORACLE_LOADER", line 19

    It would appear that you external table definition and the external data file data do not match up. Post a few input records so someone can duplicate the problem and determine the fix.
    HTH -- Mark D Powell --

  • Problem while selecting data from external tables

    Hi All,
    I am facing a problem with external tabels. I have created an external table
    create table ext_org_table
    ( id varchar2(10)
    , name varchar2(100)
    ,id_parent varchar2(10)
    ,name_parent varchar2(100))
    organization external
    ( type oracle_loader
    default directory MYDIR
    access parameters
    records delimited by newline
         nologfile
         nobadfile
    fields terminated by ','
    missing field values are null
    location ('Orgdata.csv')
    reject limit unlimited;
    The problem is that when i give select * from ext_org_table , i get following error
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-04040: file Orgdata.csv in MYDIR not found
    ORA-06512: at "SYS.ORACLE_LOADER", line 19
    ORA-06512: at line 1
    Now , i have file Orgdata.csv in the specified directory.
    I have created directory in oracle using create directory command.
    I have granted read,write permission on the directory to user.
    I have given all read,write and execute permissions to folder where my files resides.My file resides in /appl/home/kk
    Now i don't understand why it is giving error file in Mydir not found.
    Kindly suggest.
    Regards
    Krish

    Hi,
    You are obviously doing someting wrong.
    May be the direcotry is not present or may be the file is not rpesent in the directory.
    I just tried ths
    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
    Connected as SYS
    create directory mydir as 'c:\csv';
    grant read,write on directory mydir to scott;From Scott
    create table ext_org_table
    ( id varchar2(10)
    , name varchar2(100)
    ,id_parent varchar2(10)
    ,name_parent varchar2(100))
    organization external
    ( type oracle_loader
    default directory MYDIR
    access parameters
    records delimited by newline
    nologfile
    nobadfile
    fields terminated by ','
    missing field values are null
    location ('Orgdata.csv')
    reject limit unlimited;
    select * from ext_org_table;Ofcourse i made up some dummy data to test and its all OK.
    again,
    You may want to check if
    1) If the directory exists (select * from all_directories where directory_name='MYDIR');
    2) If the user has the read/write permissions on that directory
    3) If the file orgdata exists in that directory.
    Regards,
    Bhushan

  • How to select data from a table using a date field in the where condition?

    How to select data from a table using a date field in the where condition?
    For eg:
    data itab like equk occurs 0 with header line.
    select * from equk into table itab where werks = 'C001'
                                                      and bdatu = '31129999'.
    thanks.

    Hi Ramesh,
    Specify the date format as YYYYMMDD in where condition.
    Dates are internally stored in SAP as YYYYMMDD only.
    Change your date format in WHERE condition as follows.
    data itab like equk occurs 0 with header line.
    select * from equk into table itab where werks = 'C001'
    and bdatu = <b>'99991231'.</b>
    I doubt check your data base table EQUK on this date for the existince of data.
    Otherwise, just change the conidition on BDATU like below to see all entries prior to this date.
    data itab like equk occurs 0 with header line.
    select * from equk into table itab where werks = 'C001'
    and <b> bdatu <= '99991231'.</b>
    Thanks,
    Vinay
    Thanks,
    Vinay

  • How to select data from a table by passing document number from another tab

    How to select data from a table by passing document number from another table.
    for eg:-
    I want to display name, adres, region from ADRC table
    by using field delivery document number
    Kind Regards,
    Shanbagavalli.S

    Hi Shanbagavalli,
    There are multiple solutions to this questions a few i will try to answer and then you can take the best required for your requirements.
    **Consider that you have a Internal table having document number from other table..
    SELECT NAME ADRES REGION FROM ADRC
           INTO IT_ADRC
           FOR ALL ENTRIES IN IT_DOC
           WHERE DOCUMENT_NO = IT_DOC-DOCUMENT_NO.
    **Consider that you have 1 document number then
    SELECT NAME ADRES REGION FROM ADRC
         INTO IT_ADRC
         WHERE DOCUMENT_NO = W_DOCUMENT_NO.
    Hope this solves your problem.
    Regards,
    Kunjal

  • How to use for all entires clause while fetching data from archived tables

    How to use for all entires clause while fetching data from archived tables using the FM
    /PBS/SELECT_INTO_TABLE' .
    I need to fetch data from an Archived table for all the entries in an internal table.
    Kindly provide some inputs for the same.
    thanks n Regards
    Ramesh

    Hi Ramesh,
    I have a query regarding accessing archived data through PBS.
    I have archived SAP FI data ( Object FI_DOCUMNT) using SAP standard process through TCODE : SARA.
    Now please tell me can I acees this archived data through the PBS add on FM : '/PBS/SELECT_INTO_TABLE'.
    Do I need to do something else to access data archived through SAP standard process ot not ? If yes, then please tell me as I am not able to get the data using the above FM.
    The call to the above FM is as follows :
    CALL FUNCTION '/PBS/SELECT_INTO_TABLE'
      EXPORTING
        archiv           = 'CFI'
        OPTION           = ''
        tabname          = 'BKPF'
        SCHL1_NAME       = 'BELNR'
        SCHL1_VON        =  belnr-low
        SCHL1_BIS        =  belnr-low
        SCHL2_NAME       = 'GJAHR'
        SCHL2_VON        =  GJAHR-LOW
        SCHL2_BIS        =  GJAHR-LOW
        SCHL3_NAME       =  'BUKRS'
        SCHL3_VON        =  bukrs-low
        SCHL3_BIS        =  bukrs-low
      SCHL4_NAME       =
      SCHL4_VON        =
      SCHL4_BIS        =
        CLR_ITAB         = 'X'
      MAX_ZAHL         =
      tables
        i_tabelle        =  t_bkpf
      SCHL1_IN         =
      SCHL2_IN         =
      SCHL3_IN         =
      SCHL4_IN         =
    EXCEPTIONS
       EOF              = 1
       OTHERS           = 2
       OTHERS           = 3
    It gives me the following error :
    Index for table not supported ! BKPF BELNR.
    Please help ASAP.
    Thnaks and Regards
    Gurpreet Singh

  • How can we improve the performance while fetching data from RESB table.

    Hi All,
    Can any bosy suggest me the right way to improve the performance while fetching data from RESB table. Below is the select statement.
    SELECT aufnr posnr roms1 roanz
        INTO (itab-aufnr, itab-pposnr, itab-roms1, itab-roanz)
        FROM resb
        WHERE kdauf  = p_vbeln
        AND   ablad  = itab-sposnr+2.
    Here I am using 'KDAUF'  & 'ABLAD' in condition. Can we use secondary index for improving the performance in this case.
    Regards,
    Himanshu

    Hi ,
    Declare intenal table with only those four fields.
    and try the beloe code....
    SELECT aufnr posnr roms1 roanz
    INTO  table itab
    FROM resb
    WHERE kdauf = p_vbeln
    AND ablad = itab-sposnr+2.
    yes, you can also use secondary index for improving the performance in this case.
    Regards,
    Anand .
    Reward if it is useful....

  • How to select data from cluster table

    hi experts,
                   I have a report which picks data from bseg (cluster table ) for a month report it is taking around 4 minutes to process.I feel it is not good when take the report after some months.
    how to select data from these table???how to declare itab for these cluster tables????can we include any search condition or any other kind of internal table???
    please advice.
    mani

    Hi Manikandan,
    The following code may be helpful to understand how to select the data from cluster table.
    Types: Begin of ty_kna1,
    Kunnr type kna1-kunnr,
    adrnr type kna1-adrnr,
    end of ty_kna1,
    begin of ty_bseg,
    belnr type bseg-belnr,
    kunnr type bseg-kunnr,
    end of ty_bseg,
    begin of ty_final,
    belnr type bseg-belnr,
    kunnr type kna1-kunnr,
    adrnr type kna1-adrnr,
    end of ty_final.
    Data: it_kna1 type table of ty_kna1,
    wa_kna1 type ty_kna1,
    it_bseg type table of ty_bseg,
    wa_bseg type ty_bseg,
    it_final type table of ty_final,
    wa_final type ty_final.
    Select kunnr adrnr from kna1 into table it_kna1 where....
    if sy-subrc = 0.
    select belnr kunnr into table it_bseg for all entries in it_kna1 where kunnr = it_kna1-kunnr.
    endif.
    sort it_kna1 by kunnr.
    Loop at it_bseg into wa_bseg.
    move wa_bseg-belnr to wa_final-belnr.
    read table it_kna1 into wa_kna1 with kunnr = wa_bseg-kunnr binary search.
    if sy-subrc = 0.
    move: wa_kna1-kunnr to wa_final-kunnr,
    wa_kna1-belnr to wa_final-belnr.
    endif.
    append wa_final to it_final.
    clear wa_final.
    endloop.
    Loop at it_final into wa_final.
    write: / wa_final-belnr, wa_final-kunnr, wa_final-adrnr.
    endloop.
    Reward if useful.
    Thankyou,
    Regards.

  • Error while activating data from new table of DSO to active table

    HI,
    while activating data from new table of DSO to active table i am getting
    error message as "Error occurred while deciding partition number".
    Plz any idea hoe to resolve this one.
    thanks & regards
    KPS MOORTHY

    Hi
    You are trying to update/upload the Records which are already been there in the DSO Active Data Table which has the partition.
    Try to see the Record Nos already been activated and update/upload with selective, if possible.
    You can trace the changes at Change log table for the same.
    Hope it helps
    Edited by: Aduri on Jan 21, 2009 10:38 AM

  • Select data from two tables...!

    HI Experts...!
    i m a beginner user and i want to select data from two tables proj and prps.....using joins.....and internal tables i have written a code...
    SELECT prps~pspnr
           prps~objnr
           prps~psphi
           proj~ernam
           proj~erdat
           proj~pspnr
    INTO  table itab   -
    itab is internal table
    FROM prps inner join proj
    WHERE pspnr in p_no and prpspsphi = projpspnr.
    but there is error in from clause ..please help me....
    Advance thanx....

    Hi,
    check the sample code bellow above two reply will solve out your problem but one more extra line in your code pointed out bellow.
    TABLES: prps, proj.
    TYPES:  BEGIN OF ty_test,
            pspnr LIKE prps-pspnr,
            objnr LIKE prps-objnr,
            psphi LIKE prps-psphi,
            ernam LIKE proj-ernam,
            erdat LIKE proj-erdat,
            END OF ty_test.
    DATA: itab TYPE STANDARD TABLE OF ty_test WITH HEADER LINE.
    SELECT-OPTIONS: p_no FOR prps-pspnr.
    SELECT  prps~pspnr
            prps~objnr
            prps~psphi
            proj~ernam
            proj~erdat
    *        proj~pspnr " No need for this you have selected this in
    *     the first line because it is commone so you only need to select from any one
            INTO TABLE itab
    FROM prps INNER JOIN proj ON ( prps~pspnr = proj~pspnr  )
    WHERE prps~pspnr IN p_no.
    Best Regards,
    Faisal
    Edited by: Rob Burbank on Dec 24, 2009 12:24 PM

  • Selecting data from two tables

    I am trying to select data from two tables.  The only problem that I am running into, is that i am only seeing results from my 'uploads' table.  there is also a record in documents where user = 1 that should show up.  here is my sql:
    $userIDNum = 1;
    $sql="Select *
    from uploads, documents
    WHERE uploads.user = documents.user AND uploads.user = $userIDNum
    ORDER BY uploads.title ASC, documents.title ASC";

    You'll need to explain a little more about your data and what you are trying to accomplish. Your current sql will select all columns from both the uploads and documents tables but only rows where the user id in both tables match, AND the user id equals 1. Is that not what you are seeing? Where's the code that outputs the results?

  • Mutating Problem when insert  while selecting data from dual

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

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

  • How Select data from four tables

    Hi Sdners,
    How select data from four or more tables please give me any suggestion. iam learner please help me
    Advance wishes
    sreenu
    Moderator Message: I've already locked 2 threads of yours. Please read the Rules of Engagement of this forum and abide by it.
    Edited by: kishan P on Sep 5, 2010 9:12 PM

    I think there was a sample of using CURSOR in the XSQL docs.Check section:
    Using the CURSOR Operator for Nested Rowsets
    null

  • How to select data from AZure table storage without row key and partition key

    Hi 
    I need to select a data from azure table storage without rowkey and partition key. how  in azure storage emulator click query it display all data from that table. 
    thanks 
    rajesh 

    Hi rajesh,
    It seems that you didn't click query data using storage emulator. But I recommend you could use the azure server explore in your VS to view your data and query data. Please see this document (http://msdn.microsoft.com/en-us/library/azure/ff683677.aspx).
    And base on my experience, you may need input the command on Azure storage emulator, such as this page(http://msdn.microsoft.com/en-us/library/azure/gg433005.aspx).
    Regards,
    Will
    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.

  • Procedure to insert data into table by selecting data from another table

    Hi all,
    I have to create a procedure where i have to select the data from one table and insert it into another table. Any help on this. And i have to update the 2nd table also when ever new records got inserted in the 1st table then.
    Regards

    Hi, you can try something like:
    CREATE [OR REPLACE] PROCEDURE procedure_name
    IS
    BEGIN
    INSERT INTO TABLE1
    VALUES (SELECT * FROM TABLE2);
    END;
    For the other part you may create a trigger on the first table AFTER INSERT to insert the values in the second table too.

Maybe you are looking for

  • 20" ACD (Aluminum): Glare and harsh colours

    Compared to my 12" Powerbook G4 screen, I notice that the brightness of the 20" ACD is much higher. Also, the colours on the ACD are harsher (perhaps more saturated is the term?) and not "cool" to look at in comparison with the 12" PB screen. The res

  • Layout and moving forward backward

    hello, i'm beginner in report and i try to modify a complex report i would like to move in the layout editor, a field that i have created to put it in the good place in layout tree but in the menu layout, "move backward" doesn't work and when i use "

  • Sound only with headset plugged in

    Need help. The sound on my computer only works if the headset is plugged in. I have been thru ALL the microphones, none are muted, the device manager, all are working properly. Downloaded the updates, etc. Hopefully, there is just a check mark somewh

  • How can i run OS 9 (classic) on an intel IMAC G5 running Leopard 10.5.6

    Hi, I run a program that requires classic, i have been running a G4 laptop on the side of my imac, but i would really like to just use my iMac as a 'one does it all' scenario. Does anyone know how i can run the Classic mode as a background to my Leop

  • Dvd player does not read windows 7 dvd

    i have bought a this windows version Windows 7 Professional 64 Bit OEM inkl. Service Pack 1 but my dvd player (imac 24", core 2 duo, 2,8 GHz, 4GB) does not start this dvd. anyone knows why?? thanks for answers.