Need some suggestions in writing package..

Hi everyone,
I am just asking this question to know a better way than what i am doing.
I have a patient with 2 million rows in it.Is it possible to extract 2 million rows in a text file using UTL_FILE?.I need to extract each patient related data which comes from differnt tables (bigger than patient table) in a comma deleted file.For each patient id i have to query other tables and get the data related to that patient(according to the requirement).For that i need to call different functions against different tables.
Some think like this..
Create or replace procedure XXXX
cursor -----> to get the patient id's
variables ------> declare any other variables
begin
file handler for utl file to write into a file
open cursor
using bulk collect to fetch limited no of rows
For each patient id loop
data1 := function1
data2 := function2
data3 := function3
string : = data1|| data2 || data3|| ....
UTL_FILE.put_line
reset the string
end loop;
end;
My questions are:
Is it OK to call differnt functions for each patient id (2 million patients) are there? is there any better way to do this.
Please give me some suggestions if i need to change any steps that i am following to get better performance.
Thanks
Phani

Hello,
It would be strongly advisable to minimise your function calls here.
What I would suggest is: writing one piece of SQL to be looped through with BULK COLLECT, so these:
data1 := function1
data2 := function2
data3 := function3Will be taken care of in the main SQL. Otherwise things will be very, very slow.
Therefore, something like this:
BEGIN
DECLARE CURSOR c_all_data IS
                    SELECT -- put all your data to be retrieved in this SELECT, that will easily be the quickest and most efficient
                                 FROM tab1
                                 JOIN tab2 ON (...
v1,v2,...
BEGIN
   OPEN c_all_data;
   LOOP
       FETCH c_all_data BULK COLLECT INTO v1, v2, ....... LIMIT 1000;
       FOR i IN 1 .. v1.COUNT
       LOOP
            --write to your file
            UTL_FILE...
       END LOOP;
       EXIT WHEN c_all_data%NOTFOUND;
   END LOOP;
   CLOSE c_all_data;
END;

Similar Messages

  • Need some suggestion on bapi

    Hello,
         I am not able to pass multiple values for single import parameter..i tired calling function module in loop and also tried RANGES..Need some suggestion on this..
    Thanks and Regards,
           sapdev86
    Moderator Message: Basic Question
    Edited by: kishan P on Oct 14, 2010 11:46 AM

    Hi,
    BAPI is nothing but a function module and also RFC enabled. So u can call that fm from outside SAP. U can call that BAPI using some logic or u can make hardcoding the parameters, its depends mainly on ur requirement.
    Regards
    Amitava

  • Hello friends recently shifted from windows to mac need some suggestion on which software to go ahead with for editing, excel,power point presentation

    Hello friends recently shifted from windows to mac need some suggestion on which software to go ahead with for creating word editing, excel,power point presentation.

    Only Microsoft's Office for Mac 2011 14.4.8 will work on your Windows Office files in their native document format. Anything else, and particularly Apple's Pages, Numbers, and Keynote will perform translation on open, and export. This can, and will, introduce differences to your original documents, especially when sharing with others in the Windows Office 2010/2013 applications.
    Here is my short list.
    Office for Mac 2011 v14.4.8
    LibreOffice (latest)
    The current iterations of Apple's Pages, Numbers, and Keynote are not what I would term business/professional grade applications. Apple updates them infrequently, ignores user friendly features, omits others, and has introduced default backwards incompatibility between Yosemite and prior OS X releases of these applications. Read the reviews in the OS X App Store. Even for free with a recent Mac purchase, these products will transform your mood.
    The free LibreOffice is aggressively developed and designed as an MS Office replacement suite. There are occasions where it can open documents that Office for Mac, and Apple's products ignore. Extensive PDF manuals for the individual applications. Unlike Word, you can have two-up page viewing with a button click, or edit multi-page PDF. There is a forms designer. It can open nearly any document including MS Publisher and Visio documents from the Windows space. I use it.
    MS Office 2015 Preview for Yosemite is available, but as its title would suggest, it is not done yet, and some features are missing. I created a single-page Word document with a DRAFT watermark. Only LibreOffice v4.4.1 was able to open this document and preserve the watermark.

  • I need some suggestions on what type of dock to buy for my iPod Touch 4 that would be combatable with it.

    I use to have a JBL dock for my iPod Touch 4 but it no longer works with it.  I seem to be having some problems finding a dock that would work with a iPod Touch 4.   All I want is a good dock with stereo sound and that is chargable and would also have an adaptor so I won't have to use batteries but one with batteries will do if that's all I can find.  I don't need one that has a radio and a clock with it.  One that probably doesn't go over 100.00.  Would like some suggestions from anyone please?   Thanks.

    Thanks for the replies. I have finally found a definitive answer on the Microsoft website (after a few days of virtual digging).
    http://download.microsoft.com/download/6/B/A/6BA3215A-C8B5-4AD1-AA8E-6C93606A4CFB/Windows_Server_2012_R2_Remote_Desktop_Services_Licensing_Datasheet.pdf
    And I quote for the benefit of everyone else looking for the same answers:
    "While RDS is shipped with Windows Server software, it is licensed separately through a Client Access License (CAL) model. This means that each accessing end point (i.e., a User or a Device) must be covered by an RDS license to access Microsoft VDI infrastructure.
    And this CAL is an additive CAL, which means that in addition to a Windows Server CAL, customers must acquire a Windows Server RDS CAL for each user or device that:
    - Directly or indirectly accesses any of the RDS product functionality, and/or
    - Directly or indirectly interacts with the graphical user interface of the server software using RDS functionality or other third-party technology
    For example, to access RDS functionality in Windows Server 2012 R2, Windows Server 2012 CALs and Windows Server 2012 RDS CALs are required along with the server software licenses."

  • Need some suggestions on ABAP webdynpro ..

    Hi
    I am actually a java guy. But now i m moving to Object Oriented ABAP. I have to work in ABAP Webdynpro. Could anyone please tell me
    How much time it will take to learn OOAbap ?
    Could u please suggest me which book is best for learning OOABAP ?
    Any online books are available?
    Thanks & Regards
    Ravi Shankar B

    For ABAP OO:
    http://www.sapgenie.com/abap/OO/index.htm
    For Materials:
    1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291
    2) http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    3) http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
    6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
    7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
    8) http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
    1) http://www.erpgenie.com/sap/abap/OO/index.htm
    2) http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    <b>For ABAP Webdynpro:</b>
    Look at the below thread for documents & example..
    I want some Material for WebDynpro Applications?
    Re: i need material on ABAP Webdynpro..
    <b>*Reward each useful answer</b>
    Raja T

  • Need some suggestions

    We generally have meetings between ourselves and our vendors. So it can vary who we are communicating with. The meetings can also span from a couple people up to 50 depending on the topic.

    Hello everyone!
    We are currently using LoopUp for all of our conference calling now, but we are looking for some alternatives to this service. We would be interested in  doing video and voice in one package. Please let me know what everyone out there is using, and any suggestions would be great!
    Thanks for the help!
    This topic first appeared in the Spiceworks Community

  • Need some suggestion​s for creating a software based digital I/O counter

    Hi All
    I've been using LabVIEW to sucessfully create a number of fluid level monitoring applications for oil well drilling. bear in mind that I'm a geologist not a software engineer so you may have to talk/type slowly .
    I've been using the USB 6009 & 6008 for these aplications so far, they are however limited by only having 1 counter per DAQ. What i'd like to do (if possible) is use the some of the digital I/O channels as counters. The events i'm attempting to count are simple open/closed pulse signals from a micro switch. The micro switch is attached to a slow running mud pump which is sending up to 3 pulses per second but is usually running at 10-80 pulses per min. The slow cycle rate of these big pumps means I can't use a frequency aplication as they don't seem to work below 1hz.
    I've tried to use a case structure to create a counter but I'm afraid I can't seem to get the logic right to turn the output into a counted output. Anyone got a suggestion for things I could try?
    Thanks
    Kim

    Kim,
    Tttt yyyy pppp iii nnn gggg slowly.
    You described your situation quite clearly.
    As you probably know the digital inputs on the USB-6008/9 are software timed, so you have some uncertainty in the time of any sample.  Depending on your OS that uncertainty will typically be on the order of a few milliseconds but occasionally may be much longer.
    To count the pulses in software requires a combination of several things.
    1. You need to have a data acquisition method which is fast enough to capture each high and low state of the pulses produced by the pump.  For software timed Digital Input a good way to do this is to have an independent, parallel loop which reads the input line rapidly and passes the data or transitions to another loop via a queue.  This is known as the Producer loop in a Producer/Consumer architecture.  Examples come with labVIEW. A 10 ms Wait in the loop is probably appropriate.
    2. You need to convert the digital inputs (levels) into pulses or transitions to be counted.  Suppose you want to increase the count by one every time the logical level changes from False to True. To do this you need to know the previous level and the current level. A shift register is one of the best ways to do this in LV.  Add a shift register to the loop.  Initialize it to False. Connect the result of the Digital Read to the right terminal of the shift regsiter inside the loop.  When that Read is True and the previous value (obtained from the left terminal of the shift register) is False, increment the count value (which is also kept in a shift register) in the case structure.
    3. You did not indicate what you are doing with the counts or what the pulses represent.  Do you need to measure the frequency (or the period which is the reciprocal of the frequency)?  Do you need to accumulate the number of pulses? Over what time period?
    Lynn

  • Need some help in writing a function

    Hi all,
    I need to write a function....
    the data in a table is of varchar2 type and its a ,separated values.
    its in many forms
    sample ex:1,2,3,4,,,,,76,
    12,32,,,,,,,,
    12,32
    12,,,,,23,,,,
    the total numbers in that field must be 10.
    So i need to write sthg which takes the data,remove the commas and return as an array.As in the example some numbers are missing and only ,'s are there.
    If a number is missing i need to load NULL in place of that.the output must be an array containng 10 values(if no value a NULL).
    Can anyone help me regardng this....

    create table x1 (x varchar2(100))
    insert into x1 (x) values ('1,2,3,4,5,6,7,8,9,10');
    insert into x1 (x) values ('1,,3,,5,,7,,9,');
    insert into x1 (x) values ('1,,,,,,,,10');
    insert into x1 (x) values ('1,2,3,,,,,8,9,10');
    insert into x1 (x) values ('1,,3,,5,,7,,9,');
    create type vc20_ttyp is varray(10) of varchar2(20)
    create or replace function tokenize(p_str               in varchar2,
                                        p_seperator               in varchar2 default ',')
      return vc20_ttyp is
    v_tab     vc20_ttyp;
    v_tmp     varchar2(32767);
    v_token     varchar(256);
    x     integer;
    begin
    v_tab := vc20_ttyp();
    v_tmp := ltrim(rtrim(p_str));
    while v_tmp is not null
    loop
      x := instr(v_tmp, p_seperator);
      if x = 0
       then x := length(v_tmp)+1;
      end if;
      v_token := ltrim(rtrim(substr(v_tmp, 1, x-1)));
      if v_token is not null
       then v_tab.extend;
            v_tab(v_tab.count) := v_token;
       else v_tab.extend;
            v_tab(v_tab.count) := null;
      end if;
      v_tmp := substr(v_tmp, x+length(p_seperator));
    end loop;
    return v_tab;
    end tokenize;
    SQL> declare
      2   x vc20_ttyp;
      3  begin
      4   for rec in (select * from x1) loop
      5     x := vc20_ttyp();
      6     x := tokenize(rec.x,',');
      7    
      8     for i in 1..x.COUNT loop
      9       dbms_output.put_line(nvl(x(i),'null'));
    10     end loop;
    11 
    12   end loop;
    13  
    14  end;
    15  /
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    1
    null
    3
    null
    5
    null
    7
    null
    9
    1
    null
    null
    null
    null
    null
    null
    null
    10
    1
    2
    3
    null
    null
    null
    null
    8
    9
    10
    1
    null
    3
    null
    5
    null
    7
    null
    9
    PL/SQL procedure successfully completed.

  • Need some suggestions on a possible career move.

    I have Labview training and continuing with more advanced training. I want to pursue a more challenging career either in avionics or other aerospace field. Any suggestions as to the direction to go? I do not work for a major aerospace company. What companies, etc. I am looking for something more challenging. Learning Labview was exciting, challenging, and stimulating. I see a lot of areas to use it. Do some companies hire specific Labview programmers? Unfortunately no one in my level of the avionics field even knows about Labview and what it is.

    Sure lots of companies hire programmers. For instance select integrators and alliance members hire LV programmers. In these companies most of the time you will get the opportunity to work with a variety of applications sometimes including aerospace, avionics, etc. Try looking on the ni website under the alliance program you might find some companies to contact.
    BJD1613
    Lead Test Tools Development Engineer
    Philips Respironics
    Certified LV Architect / Instructor

  • Need some suggestion for Demantra Shape modeling

    Hi All
    Can any one sugesst me how to create a Demantra Shape modeling using 7.2 version. I am working on a POC which includes shape modeling.
    Thanks
    Ram

    Kim,
    Tttt yyyy pppp iii nnn gggg slowly.
    You described your situation quite clearly.
    As you probably know the digital inputs on the USB-6008/9 are software timed, so you have some uncertainty in the time of any sample.  Depending on your OS that uncertainty will typically be on the order of a few milliseconds but occasionally may be much longer.
    To count the pulses in software requires a combination of several things.
    1. You need to have a data acquisition method which is fast enough to capture each high and low state of the pulses produced by the pump.  For software timed Digital Input a good way to do this is to have an independent, parallel loop which reads the input line rapidly and passes the data or transitions to another loop via a queue.  This is known as the Producer loop in a Producer/Consumer architecture.  Examples come with labVIEW. A 10 ms Wait in the loop is probably appropriate.
    2. You need to convert the digital inputs (levels) into pulses or transitions to be counted.  Suppose you want to increase the count by one every time the logical level changes from False to True. To do this you need to know the previous level and the current level. A shift register is one of the best ways to do this in LV.  Add a shift register to the loop.  Initialize it to False. Connect the result of the Digital Read to the right terminal of the shift regsiter inside the loop.  When that Read is True and the previous value (obtained from the left terminal of the shift register) is False, increment the count value (which is also kept in a shift register) in the case structure.
    3. You did not indicate what you are doing with the counts or what the pulses represent.  Do you need to measure the frequency (or the period which is the reciprocal of the frequency)?  Do you need to accumulate the number of pulses? Over what time period?
    Lynn

  • IMac dead, need some suggestions

    I have the intel based iMac that I purchased late oct 2006. Was having problems with it 6 months ago, they looked at it and decided to install a new logic board and a new hard drive. Sunday the computer was on and when I went back to use it, it was off and now won't turn on at all, no lights, no dings, nothing. I will call Apple Care tonight and have an appointment tomorrow but does anyone have any suggestions as to anything I can do to try and resolve this? At the very least I want to get my data off of it, I read that it's possible to take out the hard drive assuming it still works and put it in an enclosure and get the info that way.
    Assuming it is the logic board again what are the odds they will fix it? I am 3 weeks out of Apple Care and I guess replacement parts only have a 3 month warranty. It seems a little ridiculous that a new part would fail 6 months later and I have no course of action.
    Just looking for some help and any personal experiences with this problem.
    Thanks

    HI,
    *"it was off and now won't turn on at all,"*
    Try resetting the SMC. http://support.apple.com/kb/HT1806
    You could try booting from your Mac install disk and running the Apple Hardware Test
    Carolyn

  • Training: Need some Suggestions

    My COmpany is willing to send me for some training. Does anyone know where I should start looking. Im interested in courses on Network Programming (with Java) for distributed systems, and client server style applications. Please post any and all resources you know of, Thank you.

    i would suggest you study the java tutorial. there's an artikle about network programming. there you can read about sockets, rmi, ...
    you can find the java tutorial on java.sun.com
    i hope i could help

  • Need some suggestions or help with shopping cart.

    I am looking and searching and searching and looking for a
    good e-commerce package I can use with my future sites as well as a
    current one I am developing. It is a automotive site with multiple
    sizes of parts and accessories, I have opted to use a drop down for
    selecting the size but need to figure out how to incorporate that
    when I do the shopping cart and etc... I have looked at cartweaver
    and cannot afford that right now I am looking for something similar
    to it but cheaper in price if not free...

    I've used Cartweaver and found it rather good. It's one of
    the few that can be licensed so as you can use it on as many sites
    as you want. Most only allow you to use a shopping cart on a single
    site.
    I've used Cartweaver ColdFusion. They also have a PHP and ASP
    version of the software, you'll need to decide what back-end
    technology you want to use: ASP, PHP, ColdFusion. and buy that one.
    I would check with your hosting company and see what back-end
    technology they offer you.

  • Need some suggestion doing database backup

    Hi All,
    I am working on the 11gR2 RAC oracle database and below are the details.
    SQL>select * from gv$version;
    INST_ID BANNER
    2 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    2 PL/SQL Release 11.2.0.1.0 - Production
    2 CORE 11.2.0.1.0 Production
    2 TNS for Linux: Version 11.2.0.1.0 - Production
    2 NLSRTL Version 11.2.0.1.0 - Production
    1 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    1 PL/SQL Release 11.2.0.1.0 - Production
    1 CORE 11.2.0.1.0 Production
    1 TNS for Linux: Version 11.2.0.1.0 - Production
    1 NLSRTL Version 11.2.0.1.0 - Production
    3 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    3 PL/SQL Release 11.2.0.1.0 - Production
    3 CORE 11.2.0.1.0 Production
    3 TNS for Linux: Version 11.2.0.1.0 - Production
    3 NLSRTL Version 11.2.0.1.0 - Production
    ps -ef|grep pmonoracle 11077 11067 0 10:37 pts/0 00:00:00 grep pmon
    oracle 12383 1 0 2011 ? 00:16:18 ora_pmon_cc2crt2
    oracle 12432 1 0 2011 ? 00:07:43 ora_pmon_cc3crt2
    oracle 12437 1 0 2011 ? 00:07:11 ora_pmon_cc4crt2
    oracle 12814 1 0 2011 ? 00:06:01 ora_pmon_ccoreqal2
    oracle 12816 1 0 2011 ? 00:05:50 ora_pmon_ccorecrt2
    I have 5 databases in these three severs and having around 20 GB of size except one database. The size of the this database (ccoreqal2) is 7.5 TB. I have took the full database backup using expdp for all DB's except the BIG size DB. i am not able to use the expdp because of the size. Which way is best to do the backup for this big size DB.
    The purpose of taking the backup is, we are upgrading our oracle to 11.2.0.3 and We don't have any regular backups (RMAN or EXPORT) on these databases. these are QA databases.
    Please let me know, how i need to prepare for this DB backup.
    Thanks in advance for your help.

    >
    i am not able to use the expdp because of the size
    >
    Why not? You can have expdp create multiple files on export so that each file is no larger than the size you specify. This makes it easier to manage large exports.
    Using multiple files and a parallel export will handle this for you.
    See the DUMPFILE section of the database utilities doc - http://docs.oracle.com/cd/B19306_01/server.102/b14215/dp_export.htm
    It has this example of file splitting using PARALLEL
    >
    Example
    The following is an example of using the DUMPFILE parameter:
    expdp hr/hr SCHEMAS=hr DIRECTORY=dpump_dir1 DUMPFILE=dpump_dir2:exp1.dmp,exp2%U.dmp PARALLEL=3
    The dump file, exp1.dmp, will be written to the path associated with the directory object dpump_dir2 because dpump_dir2 was specified as part of the dump file name, and therefore overrides the directory object specified with the DIRECTORY parameter. Because all three parallel processes will be given work to perform during this job, the exp201.dmp and exp202.dmp dump files will be created and they will be written to the path associated with the directory object, dpump_dir1, that was specified with the DIRECTORY parameter.

  • Trying to call a function from a variable in Flex 4.0 ActionScript and need some suggestions

    I am attempting to build a site map in Flex. I have my links (or will have) in a database, along with a "link." On click from a datagrid, I have an event handler where I can get the link. However, everything I have tried to use won't call the function. Ideally, I would like to call a function from from my topLevel application, and I can do that using the mx.core.FlexGlobals.topLevelApplication call. Can anyone point a fairly new Flex coder in the right direction? Thank you.

    Here is the function on the group component (simplified): -- I got this from one of my google searches. The other was using the SWFLoader, but since this is in the same application, I didn't think it was as relevant. Plus, the SWFLoader used some references that I couldn't resolve.
    private function site_click(event:ListEvent):void {
      var sURL:String=list.dataProvider[event.rowIndex].link;
       var sCommand:String="mx.core.FlexGlobals.topLevelApplication." + sURL;
       this.[sCommand]();
    This yields the error message ReferenceError: Error #1059: Property mx.core.FlexGlobals.topLevelApplication.myths_click() not found on sitemap and there is no default value.
    Whereas this works fine:
    mx.core.FlexGlobals.topLevelApplication.myths_click();
    sitemap is my component name.

Maybe you are looking for

  • HOW TO TRACK CHANGES IN MATERIAL MASTER

    Dear All,     I have changed material master with change number. Now i want to see both old and new material master. how to do this?

  • Javascript "Play Video" button not working in Firefox

    When clicking on "play video" (java), QuickTime will not open while using firefox. It does work in Google Chrome and IE. I have tried using a clean user profile & allowing popups, and I made sure the Java and QuickTime addons were working and up to d

  • Cinema4D lite to Ae - External Compositing Tag - drifting... help

    Trying to finish a job, at the last stages, everything is good to go using cinema4D lite and Ae Cineware. I've set up a couple of video boards and animations in cinema 4D lite (with external compositing tags) and back in after effects extract the cam

  • Satellite M45-s359, does not start up Windows

    I have a problem with this laptop. I just re-install Windows and everything was working perfectly. Well I started to updated with the windows update, but it took too long, and I had to turn it off The next day I came and turn the laptop on everything

  • Lenovo S206 ram upgrade

    The ram supported for my notebook is DDR3 1060 ? DDR3 1333 ?  and max supported is 4g ? and how many slots have ?