How to do this in oracle ?

Hello,
from time to time i have to process two text-files that i receive from a 3rd party application. The "processing" is pretty simple, i only have to filter out some data with a sql query that is not complex at all. The filtered results have to be stored as a csv file on the harddisk.
So far i've been using MS Access for this but now i would like to switch this to oracle.
Now i was wondering if some of you can suggest me whats the best way of doing this. I would like to automate things as much as possible, for example just calling some stored procedure.
Would you use external tables rather than sqlloader to get access to the data in the text files ? Beside using the spool command to create the csv files are there better ways to write the flat file ?

One approach could be like this.
1. create an external table for each file separately. This would enable access to the two query with simple SQL.
2. Now you can do your "Processing" over the external table. Note that external tables are read only.
3. Once the processing is done then use UTL_FILE to create the new file you want in the server directory.
The advantage of using External Table and UTL_FILE is that they are part of oracle database. They are not external tools of oracle. But SQL Loader is an external tool and Spool is a SQL Plus feature which is again an external tool. So when you want to automate something using PL/SQL they wont be handy.
Thanks,
karthick.

Similar Messages

  • How to implement this in Oracle Apps 11i

    Hello Friends
    I am working as a consultant for a manufacturing company.
    They have a format for charging Excise and Sales tax on their products (example below). I dont know how to implement this using oracle apps. Please help me ASAP.
    eg.
    Product A:
    MRP = Rs. 100
    Assessable Value (i.e. the value at which I have contract with the Government to pay Excise Duty) = 60% of MRP = Rs. 60 in this case.
    Excise Duty = 16% of AV =0.16*60 = Rs. 9.6
    Now, let’s suppose I am selling my product to a dealer at 30% discount.
    Therefore, Sale Price = 70% of MRP = Rs. 70
    Sales Tax = 4% of Sale Price = 0.04*70 = 2.8
    Therefore, total revenue from the deal = 70-9.6-2.8 = Rs. 57.6

    you can use Advance Pricing or creating discount or attiribute while calculating.
    this is not much complex, possible even with Advance Pricing too. Thanks
    Shiv

  • How to do this in Oracle discoverer for OLAP

    I have two dimensions like commodity ( having 3 levels) and organisation ( having 8 levels) and Time ( Year- Quarter-Month) . The measure is Gross spend in USD. I have calculated 4 measures on this.
    When I make the report in discoverer plus I have created the reports as organisation as page Items at level 1. Commodity is another dimension which i have put in left hand of the report.I want to compare specific month calcualtion to prior or future month selection with out having drill downs,because when we drill on year, it contains 3 quarters and contains 4 months.. the report is becoming very big and the calculations are getting for each year.how to avoid this
    ytd of dec 05 ytd of dec 06 % h % L Percentage

    There is a Year to Date calculation template that will allow you to do this.
    Keith Laker
    Oracle EMEA Consulting
    BI Blog: http://oraclebi.blogspot.com/
    DM Blog: http://oracledmt.blogspot.com/
    BI on Oracle: http://www.oracle.com/bi/
    BI on OTN: http://www.oracle.com/technology/products/bi/
    BI Samples: http://www.oracle.com/technology/products/bi/samples/

  • How to do this in oracle forms 10g

    hi all,
    any idea about how to format a drive using oracle forms 10g and shutting down the remote pc and a personal pc using oracle forms 10g.
    i am using windows XP2 as os.
    please replay..

    Hi Inol and Weiden,
    thanks for your help,
    i have cretaed a form xyz.fmx with a button , i wrote in when-button-pressed and also attached the default webutil.pll(which is in forms path) library in attached-library section
    Client_host('cmd c/ shutdown -i');
    but my problem is that when i run the form i am getting error that
    FRM-40039: Cannot attach library webutil.pl while opening form xyz.fmx.
    Cause: The given library is attached to the form but
    cannot be located in the search path for PL/SQL libraries.
    Action: Make sure that the given library can be found
    and that it has read permissions set.
    Level: 99
    Type: Error
    i think i have to configure the webutill.pll but i don't how to configure
    can you tell me how to configure the webutil.pll file..
    please reply..

  • How to do this in Oracle forms

    hi Freinds I am Using This Code in Oracle Forms
    Declare
         var_m varchar2(20) := 'employee_no';
    Begin     
    select var_m into :records.column_1 from pay_employee
        where employee_no = 1 and
                  company       = 10;
    End;Now this is Selecting one row and giving me output as
    "employee_no"
    But I do not Want This Ouput.
    Now this employee_no is the name of column in table.....so I want Its value to be Shown ,Instead of Text ?
    I want this query to get Execute
    select employee_no from pay_employeebut it is doing this
    select "employee_no" from pay_employee

    Declare
         var_m varchar2(20) := 'employee_no';
    Begin     
    select var_m into :records.column_1 from pay_employee
        where employee_no = 1 and
                  company       = 10;
    End;Of course you are getting the string 'employee_no' from your query as this is what you are selecting:
    SQL> create table testselect as select level lvl from dual connect by level < 5;
    Table created.
    SQL> select * from testselect;
           LVL
             1
             2
             3
             4
    SQL> select 'hello' from testselect where lvl = 1;
    'HELL
    hello
    SQL> select lvl from testselect where lvl = 1;
           LVL
             1have a look here:
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17126/fundamentals.htm#CIHGGGGI
    what you want to do would be
    Declare
         var_m varchar2(20) := 'employee_no';
    Begin     
    select employee_no into :records.column_1 from pay_employee
        where employee_no = 1 and
                  company       = 10;
    End;However; the result of your query would be either +1+ or a no_data_found ...
    cheers

  • How to achive this in Oracle SQL

    Hi All,
    How to get the below result:
    base table:
    COLA COLB
    112 01-JAN-2012
    113 02-FEB-2012
    114 02-MAR-2013
    115 01-APR-2013
    Result table:
    COLA COLB COLC
    112 01-JAN-2012 01-FEB-2012
    113 02-FEB-2012 01-MAR-2012
    114 02-MAR-2013 31-MAR-2013
    Thanks!

    user505326 wrote:
    Hi All,
    How to get the below result:
    base table:
    COLA COLB
    112 01-JAN-2012
    113 02-FEB-2012
    114 02-MAR-2013
    115 01-APR-2013
    Result table:
    COLA COLB COLC
    112 01-JAN-2012 01-FEB-2012
    113 02-FEB-2012 01-MAR-2012
    114 02-MAR-2013 31-MAR-2013
    Wrong Forum !!! Post at {forum:id=75}. Before posting there close this thread marking as answered.

  • How to solve this in Oracle?

    All,
    I am using Oracle 10g.I have a scenario where I have to add zeros in front of the number which is less than 9 digit.
    E.g;
    1) if any empid is less then 9 digit, let suppose it is of 8 digit then one zero needs to be added before the emp id.
    78546521(8 digit) : should be converted to 078546521 (9 digit)
    2) If it is of 7 digits then 2 zeros have to be added in fron of the empid. and so on.
    8546521(7 digit) : should be converted to 008546521 (9 digit)
    Regards
    Oracle User

    oracle user wrote:
    All,
    I am using Oracle 10g.I have a scenario where I have to add zeros in front of the number which is less than 9 digit.
    E.g;
    1) if any empid is less then 9 digit, let suppose it is of 8 digit then one zero needs to be added before the emp id.
    78546521(8 digit) : should be converted to 078546521 (9 digit)
    2) If it is of 7 digits then 2 zeros have to be added in fron of the empid. and so on.
    8546521(7 digit) : should be converted to 008546521 (9 digit)
    Regards
    Oracle UserThis points out the importance of typing data elements correctly. Just because a data element is, by convention, represented with numeric characters does NOT mean that the data is numeric in nature. Would you ever subtract one employee id from another? Would you ever multiply one telephone number by another? Would you ever take the square root of a social security number? No, you would not.

  • When i login to MES operator resp..i get a error saying...You must setup an HR employee for this Oracle Application user...how to resolve this?

    when i login to MES operator resp..i get a error saying...You must setup an HR employee for this Oracle Application user...how to resolve this?

    Hey everyone in Apple world!
    I figured out how to fix the flashing yellow screen problem that I've been having on my MBP!  Yessssss!!!
    I found this super handy website with the golden answer: http://support.apple.com/kb/HT1379
    I followed the instructions on this page and here's what I did:
    Resetting NVRAM / PRAM
    Shut down your Mac.
    Locate the following keys on the keyboard: Command (⌘), Option, P, and R. You will need to hold these keys down simultaneously in step 4.
    Turn on the computer.
    Press and hold the Command-Option-P-R keys before the gray screen appears.
    Hold the keys down until the computer restarts and you hear the startup sound for the second time.
    Release the keys.
    I went through the 6 steps above twice, just to make sure I got rid of whatever stuff was holding up my bootup process.  Since I did that, my MBP boots up just like normal.  No flashing yellow screen anymore!!   
    (Note that I arrived at this solution when I first saw this page: http://support.apple.com/kb/TS2570?viewlocale=en_US)
    Let me know if this works for you!
    Elaine

  • How can I code this in Oracle Forms?

    I have a master-detail form. In the detail block, I have several records. Here is my name table.
    ID Name_Type Name
    1 old Mike
    2 Current John
    3 old Peter
    4 old Andrew
    I would like to create a button trigger which shall perform the following:
    1) insert a record into database with a copy of current value. In the above case it will insert create a record for John as name_type = 'OLD'. So we have total of 5 records. Commit the transaction.
    2) Scroll through my detail records (5) and go to one specific record and erase the values from it. In the above case, it should find John's record with name_type = 'Current' and erase John from it.
    How can I accomplish this in Oracle forms using a button-pressed trigger?

    Hi,
    Simple, using current values you can create new id , 'old' and name so oracle will create record, now refresh block, next using next_record in loop you can find record,erase one and refresh block.
    Adinath Kamode

  • How to search this value in oracle database to find out the table

    Hi expert,
    I know there is a value in oracle database, please show me how to search this value in oracle database to find out the table holding this value.
    Many Thanks,

    918440 wrote:
    Hi friends,
    this question is really practical, I already know there is value from application saved in database, I want to search the whole database to figure out which table the value is contained.write SQL that writes SQL to query every table.
    Handle:     918440
    Status Level:     Newbie
    Registered:     Mar 2, 2012
    Total Posts:     20
    Total Questions:     10 (10 unresolved)
    why do you waste time here when you NEVER get any answer to any question you post?

  • How to write this sql  query to oracle

    Hi sir,
    i am using one query in my sql stored procedure that is:
    select @maxtime=CONVERT(Time,Out_Time+DATEADD(n,60,0)) from shift where Shift_Code = @ShiftCode
    so here i am getting this value 01/01/1900 12:00 AM
    the same i used in oracle my query is :
    to_char(Out_Time,'1900-01-01' + 0/(24*60),'DD/MM/YYYY HH:MI AM')
    INTO v_maxtime
    FROM shift
    WHERE Shift_Code = v_ShiftCode;
    but getting error that is: Encountered the symbol INTO when expecting one of the following :=(%;
    am i doing any thing wrong.
    thanks

    APC wrote:
    The error you're getting is a syntax error. In this case because you've mangled the TO_CHAR syntax. Alas I cannot give you the correct version because I cannot unpick what you're trying to do with that statement.
    It would be easier if you expalined what business logic you're trying to implement instead of asking us to interpret a piece of shonky SQL.It's yet another of the OP's questions about how to do DATEs in Oracle (so many threads it can get very confusing - even though the OP has been asked to stick to one thread!).
    The code looks like it's based on the answer I gave here:
    How to get exact query of sql in oracle?
    but clearly he doesn't understand the basic syntax of Oracle or the datatypes he's using. Sometimes you just have to give up... (I know I have)

  • How get selected data from oracle data as per give input

    sir i use Sun Java Studio Creator with oracle 10g
    my direct want user give input through both listbox , textbox or string variable
    how i pass this input in sessionbeen query and page give data in table as per user need
    please give me step and code
    this is urgent
    thank's

    You would get hierarchical data from a functrion in the same way as you would any data.  Create a function returning a cursor and then use your SQL statement to open the cursor.  Very simplistically:
    Create Function My_Func Return Sys_Refcursor As
       l_cur Sys_Refcursos
    Begin
       Open l_cur For
          'select EMPNO,ENAME,SYS_CONNECT_BY_PATH(ename, '/') "Path"
           from EMP
           start with MGR is null
           connect by prior empno=mgr';
       Return l_cur;
    End;
    Then, whatever calls the function would walk through the cursor an do whatever.
    Jhn

  • How to do this in Procedure

    HI Friends,
    I am using Oracle 11 g.
    Please find the senarion and create table script with dummy data.
    In my_table we have data also like
    RA1340001,
    RA1340002
    In this case we need to change the data as
    R134B0001
    RB1340002
    For changing the letter B we need to go to a dcn_control table where we are maintain data like(SNO, DATE_T, CAMPGN_ID)
    (1,01-06-12,RA134)Suppose for this month the 2rd letter in CAMPGN_ID field is A then next month the letter is B alphabetically. Suppose the letter is Z then will update the data as A .
    So the logic shud be If data ='RA1340001' Then check the second letter and increment+1 alphabetically to B and place the B after R134 so the value is
    R134B0001
    If the data ='RA1340002' then check the second letter and increment+1 alphabetically to B so the value is RB1340002.
    ======================
    Please find the Table script.
    =================
    CREATE TABLE dcn_control
    SNO NUMBER NOT NULL,
    DATE_T date,
    CAMPGN_ID VARCHAR2(7 BYTE) NOT NULL)
    ==============================
    Create table my_table
    data varchar2(10)NOT Null
    ========================
    insert into my_table values(' RA1340001')
    insert into my_table values(' RA1340002')
    ================
    insert into dcn_control values(1,sysdate,'RA134')
    Please let me know how to do this.
    Thanks,
    Lony

    lony wrote:
    In this case we need to change the data as
    R134B0001
    RB1340002What is the logic behind it? Is it odd/even? If so:
    SELECT  t.data,
            u.campgn_id,
            CASE MOD(TO_NUMBER(SUBSTR(t.data,LENGTH(u.campgn_id) + 1)),2)
              WHEN 0 THEN SUBSTR(u.campgn_id,1,1) ||
                            CHR(
                                ASCII('A') +
                                  MOD(
                                      ASCII(SUBSTR(u.campgn_id,2,1)) - ASCII('A') + 1,
                                      26
                               ) ||
                            SUBSTR(t.data,3)
              ELSE SUBSTR(u.campgn_id,1,1) ||
                     SUBSTR(u.campgn_id,3) ||
                     CHR(
                         ASCII('A') +
                           MOD(
                               ASCII(SUBSTR(u.campgn_id,2,1)) - ASCII('A') + 1,
                               26
                        ) ||
                     SUBSTR(t.data,LENGTH(u.campgn_id) + 1)
            END res
      FROM  my_table t,
            dcn_control u
      WHERE t.data like u.campgn_id || '%'
    DATA       CAMPGN_ RES
    RA1340001  RA134   R134B0001
    RA1340002  RA134   RB1340002
    SQL> SY.

  • How to do this in ODI

    HI Friends,
    I m installing ODI.I am using ODI 11 and Oracle 11g version.
    And we have One Master repository for Dev and UAT, mainly because we have one physical server for UAT connecting to UAT DB and Dev DB. And a separate Master repository for Production.
    So i have few inputs needed from your side:
    •Need to check Web agent and ODI Console configuration
    •Need to check Topology configuration, physical, logical and contexts.
    •Setting up projects
    •Security implementation
    •Versioning and Solution management
    For all these above point i need How to do this any step by step guide andd how much time it will take .
    Thanks,
    Lony

    lony wrote:
    HI Friends,
    I m installing ODI.I am using ODI 11 and Oracle 11g version.
    And we have One Master repository for Dev and UAT, mainly because we have one physical server for UAT connecting to UAT DB and Dev DB. And a separate Master repository for Production.
    So i have few inputs needed from your side:
    •Need to check Web agent and ODI Console configuration It will take maximum 3 hour if everything goes well.
    •Need to check Topology configuration, physical, logical and contexts. Depends on how projects you have and what are the connection details. Still it will take two hour for setup with analysis.
    •Setting up projects Depends on requirement.
    •Security implementationThis may take more than 4 hours to set the profile properly for each resource.
    •Versioning and Solution managementShould not be more than 2 hours for one project
    > For all these above point i need How to do this any step by step guide andd how much time it will take .
    I gave input for initial setup if everything is ready. But it depends on your architect as well.
    Thanks,
    Lony

  • How to do this in forms ?

    Hi,
    I have a Multi-block form and with visual attribute,if i hold the "SHIFT" key and select the multiple records,
    it should get selected.
    How to do this funtionality in the forms ? Any Idea ?
    Thanks in advance.

    http://www.google.co.in/search?hl=en&q=Oracle+forms+%2B+SHIFT+key+%2B+Select&meta=
    www.version1.com/itemfiles/file9.htm

Maybe you are looking for