2 functions with one cursor or.. 1 function with 2 cursors?

Hi friends,
I hope you help me to decide is this easy question:
Actually I have 2 functions. Both are the same more or less: Both get data from USERS table. (In the users table there are several columns, I'm interested in "code" and "description")
Function1 have a cursor which obtain data and orders by code,
Function2 have a cursor which obtain data and orders by description.
That's the only difference.
I want to "optimize" the code so I was thinking on creating only a function.
To do the same in one only function I thinked on passing a parameter i.e.: p_ordertype to know which would be the order ("C" for code or "D" for description)
In that function I would have two cursors and I would ask for the parameter to execute one "FOR...." or the other.
The question: Would it be really effective? I think that if I have 2 cursors in a function... I would cosume more memory than if I would only have one cursor.. (because I think data selected from cursors is parsed to memory when you invoke the function, before the 1st instruction after the BEGIN is executed, isn't it?)
Would it be better 2 functions with one cursor each one or... one function with 2 cursors?
Thanks in advance for your opinions.
Jose.

Hi again Todd,
there's a problem with you solution :
Imagine you have the following users:
usercode - userdescr
1 - ALAN
2 - RICHARD
3 - DANI
12 - CHARLIE
20 - BARRY
If we pass a 'C' as p_ordertype (to obtain the list like above, ordered by usercode) , the result would be:
1 - ALAN
12 - CHARLIE
2 - RICHARD
20 - BARRY
3 - DANI
Do you understand what i'm trying to explain?... I hope that... I tried with
ORDER BY DECODE(p_ordertype,'C',usercode,'D',TO_NUMBER(userdescr));
but it doesn't works...
More ideas?

Similar Messages

  • I have 2 Apple ids and two corresponding iCloud accounts. My five Apple devices are linked to one or the other. As one consequence a small number of my contacts are associated with one iCloud account, the majority with the other. How can I merge?

    For reasons not entirely clear to me I have ended up with two Apple ids, two iCloud accounts and my Apple devices being associated with one or the other iCloud account/Apple id. One of the complications is that my contacts are partially owned by one iCloud account, partially by the other.
    Is there any way to
    - merge the contacts (I have tried exporting from one and importing into the other but one set will overwrite the other)?
    - migrate all devices to one single iCloud account without being locked out for 3 months?
    - merge Apple ids or just delete one of them without locking out devices?
    Grateful for any suggestions because this is turning into a headache.

    You can merge the contacts from one account with your other one without overwriting them.  Sign into the first account, download them as vCard (iCloud: Export contact information as a vCard), email them to a device signed into the account you want to merge them with, tap the vCard and choose Add..., then Create New Contacts.
    You can also migrate a copy of the data in one account and merge it with the other by signing into the account you are leaving, then signing out (or deleting the account if not running iOS 8), then choosing Keep on My iDevice when prompted.  Then sign into the other account and choose Merge when prompted.  This won't move Notes however.  If you are syncing notes that you want to migrate from the other account, you can temporarily add the account to your Mac as a secondary account by going to System Preferences>Internet Accounts (or Mail,Contacts,Calendars)>Add Account>iCloud and signing in with the other account ID.  Then enable notes syncing in the secondary account.  You will then be able to open the notes app and drag and drop notes from one account to the other.  When you're done, delete the secondary account from your Mac.
    You can't merge IDs as Apple does not allow it.  Also, you won't be locked out of anything for 3 months.  The "90-day switch" rule only applies to changing your iTunes store account, not your iCloud account.  Just leave your iTunes store account as-is.  The ID you use for the iTunes store does not have to be the same as the ID you use for iCloud.

  • Configure Macbook Pro with one hard drive to work with FCP

    I would like to do some video editing while on the road. I have a new Macbook Pro with Final Cut installed. I know that the capture scratch should not be on the same hard drive as the application. How do I set up the computer to work with FCP when I have only one hard drive. I do have external hard drives to use when editing at home but I would like to edit while traveling in the car or on a plane.

    If you don't have an external drive attached, FCP will default to the system drive. The CAPTURE SCRATCH folder will be located in the DOCUMENTS>FCP DOCUMENTS folder. You CAN edit on the system drive, but performance might suffer and you might get dropped frames. DV, OFFLINE RT are fine, HDV and other formats might give you headaches. I have edited DV and OFFLINE RT HD on my laptop's hard drive on a plane without much problem.
    Get a bus powered hard drive like the G-Raid Mini. This way you only need one power source.
    Shane

  • Mail.app sycs with one Gmail account, won't with another

    I've searched throughout the forum and couldn't find anything (although a ton of issues with Mail/Gmail exist).
    Today is the first time I've had an issue with Gmail connecting to Mail.app, however, I have two Gmail accounts, yet my main one will not connect. Here's the error message:
    "+Logging in to the Gmail IMAP server “imap.gmail.com” failed. Make sure the user name and password you entered are correct, then click Continue. If the information isn’t correct, you cannot receive messages+."
    I check my login/password, and it's correct. I can login to Gmail using Firfox and Chrome. My secondary account can receive and send in Mail.app, but nothing in the primary.
    Anyone have an idea?

    I just downloaded Thunderbird and tried to setup my primary Gmail account, and TB has issues logging in, saying the password is invalid, yet it's the same password that I use when I login in a browser, whatever the browser may be. Here's the setup window with the error, and anything else that may be relevant (I have absolutely no knowledge of mail anything; POP, IMAP, all that jazz is pure Latin to me):
    http://img.photobucket.com/albums/v235/pacokorn77/thunderbirderrormessage.png
    Sorry for the link, but I'm not familiar with the forum code here to embed an image (if it's at all possible).
    My Mail app on my iPhone works just fine, sending and receiving, but any desktop client I use kicks back a login issue, so it looks to be on Google's end, but I can't be certain.

  • "server not found" with one ip address but ok with vpn ip

    Windows 7 For the last few days I get "server not found" message when I try to access many sites (including Mozzilla help). This happens with ie also.However when I use a different IP (via my VPN) everything is OK.
    What is going on?

    Server Not Found - Troubleshoot connection problems
    *https://support.mozilla.org/en-US/kb/server-not-found-connection-problem

  • PR-PO material with one material group and GRN with another material group

    Dear friends,
    If PR is made for 40W Philips Bulb , PO is made 40W Philips bulb and at the time of GRN it is noticed that 40W Wipro bulbs are coming then how to map this in sap?
    Regards,
    Mahesh.

    Hi
    In SAP  movement type 101 and 161 for the Auto PO at the time if Receipt,
    configuration
    1. Material Master- Auto PO enable mark this tick in purchasing view
    2.Vandor Master- Auto PO enable mark this tick in purchasing tab of vendor master
    3. Material should be valuated maetrial
    4. P oran shoud be a STD p organ and it has to be assigned with the plant,,
    5 Info record has to be maintained with the Value/price with the Validity and tax code
    6 you can not post into GR blocked stock for auto po
    check following link
    [Automatic Po creation With MB01 i am getting Error;
    [http://www.sap-img.com/materials/steps-to-create-auto-po.htm]
    Regards
    Kailas Ugale

  • WebDAV working with one page grop but not with another

    Hi,
    I have a problem - untill last week WebDAV worked ok (more or less).
    now, it works with Shared page group and with a recently added pg, however it does not work anymore with the main page group.
    Ay ideas?

    Hi John,
    what I meant was that initially the main page group would be displayed in a window, but after I try to access (or after a simple refresh) it would dissapear. No problems withh Shared and a new page group though.
    BTW, more or less means that a colleague had a problems transfering large amount of data via WebDAV. It left a huge transfer overnight and after taht he porblems started. First, the WebDAV worked occasionaly and then completely died for that particular page group.
    I am puzzled here why it works for some and not for the others.
    BTW, when I try to map a network drive for http://server/dav_portal/portal/ at different computer now, it would come up wih an error saying "the network path ... could not be found". The path does work when copied into the browser's address bar (however the main page group still unaccessable).
    Cheers.

  • Scanner won't work with one user but will work with another

    Tonight I used my scanner and it worked fine.  Then a few minutes later I tried to scan another documentand it wouldn't work.  I finally logged off, and switched users (to Administrator) and I was able to use thescanner.   I don't know why it works for one user but not the other.  (This is very inconvenient.) What do I need to do to fix it?

    Hi Rustyintegrale,
    A couple of questions...
    1. Does the unit immediately kernel panic when power from the bus hits the drive?
    2. Does it happen in multiple users?
    3. If you startup, interrupt the boot process and boot to the startup manager (by holding option on startup) and then plugin the SuperDrive does it kernel panic there as well?
    When a peripheral causes a unit to go into this state, there's little that can be done to troubleshoot from a software perspective. Especially if your answer to all three questions above was "yes." You can certainly try resetting the PRAM & SMC, to see if there is any change. But, I think the next best step might be to bring the machine and this optical drive to see a qualified technician.

  • Multiple functions in one button

    Good evening,
    Is it possible to run multiple functions with one button?
    For example: With a button to open and close an object?
    Thanks 

    Hi Rinku,
    This is an example for you:
    A Piano Key Control in C#
    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.

  • Can't video chat or screen share with one person

    Hi, I can video chat and screen share with one remote colleague but not with another. When I try, I get the message 'Failed to start screen sharing because: Screen sharing could not be established' (and a similar message for video.
    He has a brand-new iMac with Leopard, so there is no compatibility issue.
    This would be very useful for us, can anyone suggest a solution?
    Thanks
    Phil

    There are various threads on getting iChat to work with various routers. There are a couple of Support docs that talk about it, but I always have trouble finding them, now.
    Use the 'more options' search function and show posts in the last year instead of the last 90 days, which I believe it defaults to.
    One thing I know of is Internet Sharing cannot be turned on. Another common problem is double-NATting, where their modem is serving out addresses via NAT and the Router is sharing those out on its own NAT. You should only have one running.

  • Connect to the computer a sound system 7,1 with one jack ??

    hello everybody, i want to buy?the speakers system T7900, but i have only one jack slot on my computer. i have read that i can connect a system 7,1 with this slot, but i don't understand how is possible? to connect a 7,1 with jack slot. For information, i have a fujitsu siemens m3438g 75005 thank you to answer me

    I think there's no problem in connecting a 7.1 system with one jack (if so always with the green one)But you have a cheap solution that allows you to have sound on all speakers:Buy two of these http://img.mercadolivre.com.br/jm/im...65_670.jpg&v=P
    And in one of them insert the yellow and black jack and this adaptor will insert in one of the holes of the other adaptor along with the green jack having something like this.yellow/black | | adaptor/green | | adaptor | sound card
    But, although it woks you won't have the same surround sound that you could have if you connected the speakers with the 3 jacks to a sound card (without adaptors). Hope you understand, and sorry for the bad english, I'm portuguese
    Message Edited by grimreaper9 on 08-07-2007 03:03 AM

  • BETWEEN FUNCTION WITH IN A DECODE FUNTION IN A CURSOR

    The following below is my query..I have to get the hours,min and seconds from a 'yyyy-mm-dd-24hh.mi.ss' value and check if the time is between 12 am to 6 am , then write it with one value else write an another value..I am trying to use 'BETWEEN' function in decode function but i am getting error.....Can we use BETWEEN function with in decode function or is there any other way
    set serveroutput on
    declare
    cursor cur_dte is select lst_upd_date from EMPLOYESS ;
    begin
    for i in cur_dte loop
    DECODE (substr(trim(i.lst_upd_date),12)) ,between '00.00.00.0000' and '06.00.00.00.0000' ,101,102);
    dbms_output.put_line(i.lst_upd_date);
    end loop;
    end

    First of all. If you are in PL/SQL then CASE is just a more colmplex expression then IF THEN ELSE. I usually prefere If then else, but for some rare cases.
    The other issue is that you convert a datetime value into a string. This is wrong. it opens up all possible kinds of cenversion bugs. Stay with date or timestamp as long as possible.
    The solution depends a little upon the datatype of your lst_upd_date column.
    Here is a pl/sql solution assuming it is DATE.
    The TRUNC function can be used to reduce a datetime to a day or to an hour.
    declare
       cursor cur_dte is select lst_upd_date from employees ;
    begin
       for i in cur_dte loop
         if trunc(i.lst_upd_date,'HH') between trunc(i.lst_upd_date) and trunc(i.lst_upd_date)+6/24 then
            dbms_output.put_line(to_char(i.lst_upd_date,'DD-MON-YYYY HH24:MI:SS'));
         end if;       
       end loop;
    end;
    /But a pure SQL solution is much better.
    Here is how you implement it using CASE in SQL.
    example using pure sql
    select e.*,
            case when trunc(e.lst_upd_date,'HH')
                   between trunc(e.lst_upd_date) and trunc(e.lst_upd_date)+6/24
            then 101
            else 102
            end as "early_morning_check"
    from employees e;And if it is a timestamp column then you could use the EXTRACT function.
    select e.*,
            case when to_number(extract(hour from e.lst_upd_date))
                   between 0 and 6
            then 101
            else 102
            end as "early_morning_check"
    from employees e;You might want to consider if date values like 06:45:00 should be included or not.

  • Projects, is the Standard Functionality the one with COGS created?

    Korean Air manufactures AIRCRAFT components and delivers them to customers such as Boeing. It wants to implement ERP (R12) applying Oracle Projects Solution.
    Issue
    1. When Shipping Type Deliverable is created in Project Module and it is interface to Shipping Execution for Ship Confirm, COGS(Cost of Goods Sold ) for Shipping Item is created and it overlaps with cost of sales per Project/Task.
    Question
    *1. **When Shipping was done using deliverable of Shipping Type in Project Module, is the Standard Functionality the one with COGS created?*
    A. If the number 1 case is Standard Functionality, is there any option to prevent COGS creation?
    B. If the answer is no, by what kind of setup is it possible?
    C. Does Shipping of Project Module based on “non-asset based warehouse”?
    *2. What is the Integration mapping of Project Management, Shipping Execution, Inventory, AR, COGS etc?*
    The following are basic process.
    1. Quotation-> Contract -> Plan -> Production -> Delivery -> Revenue
    A. Using Deliverable in Projects
    2. Project: Agreement
    3. Task: Unit
    4. Purchasing Plan, Production Plan etc. executed based on Project/Task
    5. Cost calculation is calculated in Project/Task unit
    6. When Task (Tail Number) is completed, deliver to Boeing according to contract
    B. Interface through Shipping Execution
    C. Ship Confirm
    7. Based on cost revenue is recognized according to progression rate.
    A. Cost Collect
    B. Generate Draft Revenue
    8. Based on delivery or contract, account receivable is created and send to customer.
    A. Create Event per Task
    B. Generate Draft Revenue
    C. Interface Draft Revenue to Receivables.

    Hello Daniel,
    The PCI serial cards are not supported with LabVIEW RT for ETS targets and are not expected to work. We are looking into finding a way to add support for PCI serial devices in RT, but currently that support does not exist.
    One possible workaround would be to use a NI ENET-485-X device. The visa resource name will not be COMx in this case. Instead, you will need to enter the long name of ASRL::::::INSTR as documented in the NI-VISA help.
    I hope this helps. If you need to speak with your sales representative to resolve this issue, please follow this link. Have a great day.
    Regards,
    Kristi H
    National InstrumentsMessage Edited by Support on 01-18-2005 08:24 AM

  • Read different SV's Type with one function

    Hi,
    I have a several type of Shared Variables in my Biblio, and I Like to read them using one function. So I have connected the type of data of the VI " Search variable Container" to an cluster wich within I put Boolean, numeric and character string Constant . But it doesn't work
    In your opinion it is possible to read several type of data with one function, Or should-I use several loops to read each type of Data?
    Attachments:
    Bib.JPG ‏12 KB

    You need to show a lot more than just the fact you have 3 variables.  How am I supposed to know what type they are?  Post your Read VI if you can.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • HT4623 When an app is download with one apple id and later on needs update thn how to update with other apple if ist one is not functioning?

    When an app is downloaded with one apple id and needs update later on then how to change apple id on app store for updting that app???

    You can't. All apps are forever tied to the Apple ID used to obtain them, and cannot be updated using any other ID.

Maybe you are looking for

  • Actual price of po

    hi friends gud morning,     how can we calculate actual price of a po item .is there any fm or bapi .

  • How to make the application temporarily stop (pause)

    Hi, I'm using Jdev 11.1.2.3.0 My use case is: + I have index.jsf: load list of regions (List<TaskFlowBindingAttributes>) + in an action of one region (For ex: A-flow.xml), i will add another region to the list of regions addDynamicRegion("B-flow);  

  • Flash Player Wall Street Online Journal an Safari

    After reading the WSJ online for years, all of a sudden any article that has an image in it, causes the right side advert to pop-up on the left side and block out part of the article. Any suggestions on how to fix? Thanks. David

  • Conversion of an Instrument Driver from LabWindows/CVI to LabVIEW

    Hello All, Conversion of an Instrument Driver from LabWindows/CVI to LabVIEW http://zone.ni.com/devzone/conceptd.nsf/webmain/9A93316BEBEDB17786256FA300675A0A  But I can not find any hyperlinkt to download "LabVIEW Interface Generator for LabWindows/C

  • HP OFFICEJET 8500 ALL IN ONE

    WHEN TRYING TO PRINT AN E MAIL I GET A BOX COME UP WHICH SAYS  SCRIPT ERROR 2053 LINE 1N  INVALID PROCEDURE CALL OR ARGUMENT?  DOES ANYONE KNOW WHAT MY PROBLEM IS PLEASE