Sys_refcursor: alternative replacement

Hello,
I have defined a sys_refcursor in my procedure. Basically i dont want to give sys_refcusor instead i have to define a type and use here. Can someone tell me how do i replace sys_refcursor and use a type here? what is the alternate changes i can do instead of using sys_refcusor.
PROCEDURE p_merge_employee_info(p_schema_name in VARCHAR2,P_COUNTRY_CODE IN NUMBER) IS
     generic_cv sys_refcursor;
     generic_cv1 sys_refcursor;
     v_e_no NUMBER(7);
     v_first_name VARCHAR2(20);
     v_last_name VARCHAR2(20);
     v_soc_sec_no VARCHAR2(14);
     v_es_status NUMBER(2);
     v_address1 VARCHAR2(40);
     v_address2 VARCHAR2(40);
     v_gd_state VARCHAR2(2);
     v_gd_county VARCHAR2(4);
     v_gd_city VARCHAR2(6);
     v_zip_code VARCHAR2(10);
     v_phone VARCHAR2(10);
     v_day_phone VARCHAR2(10);
     v_birth_date DATE;
     v_gender VARCHAR2(1);
     v_as_no NUMBER(4);
     v_user_id NUMBER(10);
     v_district_id NUMBER(10);
     v_territory_id NUMBER(10);
     o_error_Text VARCHAR2(1000);
     v_sql_err VARCHAR2(4000);
     tname VARCHAR2(32);
     o_status VARCHAR2(10);
     v_schema_name VARCHAR2(100):=p_schema_name||'.';
     v_last_upd_by VARCHAR2(20) :='SYSTEM';
     v_created_by VARCHAR2(20) :='SYSTEM';
     v_user_check_id NUMBER(10);
     v_hire_date DATE;
v_fjc_no VARCHAR2(1);
     v_sql VARCHAR2(4000);
     v_emp_check NUMBER(1) := 0;
v_ejc_date_last_worked      DATE;
BEGIN
OPEN generic_cv FOR 'SELECT
     e_no ,
     e_first_name ,
     e_last_name ,
     e_soc_sec_no ,
     es_status ,
     e_address1 ,
     e_address2 ,
     gd_state ,
     gd_county ,
     gd_city ,
     e_zip_code ,
     e_phone ,
     e_day_phone ,
     e_birth_date ,
     g_gender ,
     as_no ,
     e_hire_date
FROM ' || p_schema_name || '.employee';
LOOP
o_Error_Text := 'ORA-Error in fetching the cursor values ';
tname:= NULL;
FETCH generic_cv INTO
     v_e_no ,
     v_first_name ,
     v_last_name ,
     v_soc_sec_no ,
     v_es_status ,
     v_address1 ,
     v_address2 ,
     v_gd_state ,
     v_gd_county ,
     v_gd_city ,
     v_zip_code ,
     v_phone ,
     v_day_phone ,
     v_birth_date ,
     v_gender ,
     v_as_no ,
     v_hire_date ;
EXIT WHEN generic_cv%NOTFOUND;
BEGIN
o_Error_Text := 'ORA-Error in executing district table';
tname:= 'district';
--- etc etc etc

Simple answer - not possible. Oracle does not know that these tables have the same physical structure. Oracle cannot trust you/the DBA/whoever to 100% guarantee that these tables will always have the same physical structure.
Thus Oracle does not care about a statement like "STRUCTURE OF EMPLOYEE TABLE IS SAME everywhere".
The complex answer - it is possible. One method that comes to mind is to use a single "template" for all tables. Weak cursors can then be used, but via the SELECT's projection you can ensure that the same template is used. In your code, you thus deal with this template (and its definition) and not with the table structure.
Basic example:
SQL> create or replace type TEmployee as object
2 (
3 empid number,
4 deptid number
5 );
6 /
Type created.
SQL>
SQL>
SQL> create table foo1 of TEmployee;
Table created.
SQL> create table foo2 of TEmployee;
Table created.
SQL>
SQL> insert into foo1 values( 1, 1 );
1 row created.
SQL> insert into foo1 values( 2, 1 );
1 row created.
SQL> insert into foo2 values( 3, 2 );
1 row created.
SQL> commit;
Commit complete.
SQL>
SQL>
SQL> create or replace procedure ListEmp( tablename varchar2 ) is
2 cur SYS_REFCURSOR;
3 row TEmployee;
4 begin
5 open cur for 'select VALUE(e) from '||tablename||' e';
6 loop
7 fetch cur into row;
8 exit when cur%NOTFOUND;
9 DBMS_OUTPUT.put_line( row.empid||' '||row.deptid );
10 end loop;
11 close cur;
12 end;
13 /
Procedure created.
SQL> show errors
No errors.
SQL>
SQL> exec ListEmp( 'foo1' );
1 1
2 1
PL/SQL procedure successfully completed.
SQL> exec ListEmp( 'foo2' );
3 2
PL/SQL procedure successfully completed.

Similar Messages

  • Is there an alternative replacement for the JConsole?

    When I use the JConsole to look at certain JMX values then
    it occurs often that entry fields and info texts are very short and uncomfortable.
    Is there an alternative replacement for JConsole?
    Peter

    JoachimSauer wrote:
    [J]VisualVM has a useful MBean view as well.I really like that one. I have also used MX4J as JMX client a couple of years ago. It was good at that time, don't know how it is now.
    Kaj

  • Alternative replacements for OCI --- Okay?

    In the Borland Delphi world, there is a development library
    known as ODAC (Oracle Data Access Components) URL is
    http://www.crlab.com/home.html )
    This product claims to access an Oracle server directly without
    the need for SQL*NET or OCI. Reports are that this product is
    blindingly fast. Other products exists for using Delphi with
    Oracle, but they all rely on the Oracle client being installed.
    My questions are these:
    1) Is this product legal in accordance with Oracle's licensing
    terms?
    2) Does Oracle care how their database is accessed?
    Thanks,
    Charles

    I am developing at home classes for embedded dynamic SQL using
    OCI(Oracle Call Interface) which are simple to use. The complexity of
    OCI/RDB is hidden and OCI access is lightning fast!
    RDB* rdbx = new RDB("landon/password@sid"); // instantiate
    // create array of structures, one structure per row
    // structure elements are column values...then:
    rdbx->insert_structs(address of array of structures); or reverse
    rdbx->select_structs(address of array of structures);
    When I am through developing, I'll have classes that access the table
    (desc) and design the access methods(similar to OTT or JPublisher
    (JAVA)).
    Bottom line: class RDB access methods are automatically provided
    without the overhead of ODBC. Hence the RDB, the network and the
    host types disappear!!
    These are free to anybody. [email protected]
    Using Oracle Net8, the type of host is transparent as is the network.
    These OCI classes transport easily to UNIX (I've only tried Solaris).
    I bought a new workstation and am installing Oracle under Redhat Linux 7.2

  • Replacement for obsolete 'FM NAMETAB_GET'

    Hi,
       We have been upgrading SAP from 4.6B to ECC6.0...During this process we have encountered an obsolete 'FM NAMETAB_GET', but as no documentation is available for the same, we are looking for an alternative / replacement for the 'FM NAMETAB_GET'...All suggestions are welcome...
    Thanks in advance

    Hi Nishant,
    here is the sample code for the function module NAMETAB_GET
    data:    begin of nametab occurs 60.
          include structure dntab.
    data:    end of nametab.
    call function 'NAMETAB_GET'
       exporting
         langu          = sy-langu
        tabname        = table
      tables
         nametab        = nametab
       exceptions
        no_texts_found = 1.
    REPLACEMENT
    data:    begin of nametab occurs 60.
            include structure DFIES.
    data:    end of nametab.
    CALL FUNCTION 'DDIF_NAMETAB_GET'
      EXPORTING
        TABNAME           = table
    TABLES
       DFIES_TAB         = nametab
    EXCEPTIONS
       NOT_FOUND         = 1
       OTHERS            = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    rewards if useful......

  • Pavilion d7 charger replacement

    Trying tryingnto find hp replacement part number or a good alternative replacement for the Pavilion dv7 charger

    Hi
    Can you help me with Product number & the complete model number off you unit. Please find the Link given Here how to find the details.
    Let us know how it goes!
    "I work for HP."
    ****Click the (purple thumbs up icon in the lower right corner of a post) to say thanks****
    ****Please mark Accept As Solution if it solves your problem****
    Regards
    Manjunath

  • HDD & Optical Drive replacements for Satellite A45-S1202

    Can anyone point me to an alternative replacement drive other than the CMS (100GB-250gb) 5400 RPM 2.5 PATA Universal Notebook Hard Drives?
    Can I get buy from another manufacturer... if so, what drives are recommended?
    I'd like to get more than what came with this particular computer (60gb) but these replacement prices from Toshiba seem quite steep.
    Also, the A45-S1202 came with a DVD reader / CDrW combo. drive.
    Does anyone know of an DVDrw/CDrw (DVD burner) drive replacement that works with this model?
    Any & all help is greatly appreciated!

    Hi!
    You can buy a larger HDD, this is no problem.
    The Satellite A45 is not known to me but I think the largest HDD should be 120GB because the notebook has an IDE interface and ATA-5 standard supports only the LBA 28-bit which means that HDDs larger than 120GB will be not recognized.
    So you need a 2,5 HDD and 120GB max.
    I think you also exchange the drive for a DVD burner but if you want a new one contact a local ASP. They can offer such drives.
    Bye

  • Alternate Replacements...

    Hi! I had my 8X for about 2 months before it started to have issues (not being able to receive attachments for a while, beats audio/speaker issues, etc.) until I had it alternately replaced with the Galaxy S III. I've had the S III for about a month now and I recently updated my phone to the latest OS (4.1.2) and now i'm having dropped calls, my lock screen has had some security issues (not locking or locking and opening back up automatically). After weighing these issues out, I came to the conclusion and I was better off staying the 8X because of Android's instability and constant crashes. I wanted to know if it was possible to get my old phone back (I wasn't told whether I was or not by the representative upon replacing the phone; so the misinformation shouldn't be my fault). Hopefully I can because it's the phone that I paid for ($199) and the alternate replacement was free. I would rather take the lesser of the two and deal with some speaker issues than to have a phone crashing. Hopefully this is possible. Thanks!

        Hello GiftedSoul,
    I am sorry to hear that you are having issues with your device. We can certainly look into options for getting it working again. Now with the CLNR process, devices are usually replaced with the same model device. Obviously you had an alternate replacement so it is not out of the question to have it done again, but we would first need to figure out what is happening with the current device. To look at the dropped signal issue we want you to first power off the phone and remove the sim card and leave it out for 30-45 seconds before re-inserting. This should reset the network. Also have you installed any apps recently that coincided with the issue? You can run the device in safe mode. If that does not work then we will like to try a hard reset (back up content before doing so) http://vz.to/11s0an7. If this does not work then we can certainly look into replacement options. Please keep us updated.
    TonyG

  • Powerbook Lower Memory Slot Issue, what are my options?

    Hi there,
    I have a Powerbook G4 1.5ghz that I purchased in October of 2004. I had no problems with it until after upgrading the RAM to 2 x 512mb chips and then installing Tiger which resulted in me later notcing the missing RAM and learning about the lower memory slot failure issue.
    I find that sometimes if I remove the RAM and try and power it up and then replace the RAM again that the lower slot ocassionaly does come back. Trouble is though that the machine will either crash or I loose the other RAM slot when I have to shut it down. It seems to be so intermittent this way and I'm tired of constantly removing the RAM to fiddle about with it.
    My serial number begins W8441, so it isn't covered by the returns programe. I would call Apple Support, but I am put off by a £35 charge just to have them discuss and diagnose the problem.
    I'm in the UK and as I don't have Applecare and I'm not elgiable for the returns programe can anyone tell me what they charge for a logic board replacment? Looking at what they charge in the US, it's not cheap.
    I use my Powebook for Final Cut Pro, DVD Studio Pro, After Effects mainly and I had been alright with 1gig when it was working.
    I'm really trying to decide what the best thing to do is....
    - Do I pay for the logic board replacement, which I'm not really sure I can afford right now, or to be without my machine... especially as I have read that it can just fail again.
    - Should I just buy a 1gig stick for the upper slot and try and sell my old RAM, as that would be cheaper than getting the logic board replaced?
    It's a real shame that Apple doesn't seem to want to ackowledge that this effects other users as I'd been so impressed with everything about Apple up until now.
    Thanks for any advice.

    (Browse down for findings and questions).
    The notorious lower-memory-slot-bug has hit my finally too... I never believed it until now (and I've immediately signed the petition).
    I am outside warranty and I never bought Applecare either.
    Also my powerbook, a very dear machine to me, is a less common type to have this problem: a 1 GHz G4 15" FireWire 800 OS 10.3.9 type. Funny enough my older powerbook ( a G3 Bronze) is still running strong with no problems whatsoever.
    My G4 15" also has the "white spots" problem and a dead superdrive... I cannot believe how many hardware problems I'm having with this machine in comparison to all my older macs - even my sluggish powerMac 7200/90 never gave me this many headaches...
    Alright, I'll stop complaining for now.
    I've been able to browse the internet on this and found the following statements:
    The lower memory slot gets "fried" because of a OS 10.3.9 upgrade,
    or possibly due to overheating when the powerbook is put on the users' lap,
    or possibly due to picking the powerbook up by the corners so the metal gets bent.
    + I have only seen one case where someone's UPPER memory slot was defective.
    The solution to this problem (replacing the logic board) didn't seem to be definate in many cases so I'm reluctant to try this myself (and I have very little money). The alternative (replacing the upper slot memory with a bigger type of RAM) seems a bit scary to me,
    because I wonder:
    -will the upper memory slot RAM get "fried" eventually as well after a while?
    -do you need to have something installed in the lower slot or is it possible to just install one RAM card only?
    -are there more people with a 1 GHz PB that have this problem? It seems it's mostly people with a 1,67 GHz that have been bitten by this bug and maybe that's why Apple decided to give the majority a free repair. I am not sure whether that is a common policy, I am part of the minority it seems.
    As a solutions someone posted on a board that we should all buy KTA-PBG4333/1G RAM, but here in Dutch stores it is said this memory is only compatible with 17" powerbooks....
    Does anyone know if it is suitable for 15" as well??
    G4 Powerbook   Mac OS X (10.3.9)   1 GHz G4 Powerbook FW800

  • Material Determination use stock of discontinued material

    I am trying to determine if there is a way in R/3 to have a material replace an older material but as sales orders are entered take into consideration any inventory that might still remain of the discontinued material. Here is an example.
    1.) We have 15 EA of Material A in inventory in Plant 123
    2.) We are going to discontinue Material A and replace with Material B in this plant
    3.) VB11 Condition Records are setup for the A to B substitution for order entries
    4.) Order for 20 EA for Material A comes in
    I would like to see a requirement tp use the 15 from A that are still inventory and then place an order for the remaining 5 on the new Matl B (from Mfg or whomever provides).
    Is this possible using the condition records for material determination and the follow-up material options on MRP4 view?

    Hi Bill,
    This is possible using standard SAP functionalities.
    Now considrer a situation where you are creating VB11 record for material A(to be discontiniued) which is to be substituted by material B. And the need is to deplete the available stock of material A first and then start substituting it with material B.
    In order to achieve this, while creating a record in VB11 firstly create a record for replacing mat A by mat A , then double click the record line that you have created, which will pop up a small window giving you options to enter mutiple alternatives apart from mat A. where you can you can enter material B as the second alternative/replacement after mat A.
    The sequence of material is important to decide which material is considered as the replacement by the system.
    In our case system will first replace mat A by mat A and search for stock availability, if sufficient stock or no stock available it will replace the original mat A with the alternative material entered in the VB11 record i.e. Mat B.
    Another important thing to note while creating VB11 record is a check box available as "MRP Indiciator" now this indicator plays an important role while transferring requirement to MRP.
    In our case we have Mat A which is being disontinued so we dont want the requirement for mat A to be transferred to MRP incase of shortage, instead we want the requirement for material B to be transferred for MRP.
    In this case you need to check the MRP indicator box for Material B. if not checked the requirement for Mat A would be transferred to MRP.
    Hope this clarifies your questions.
    Thanks,
    Kishor

  • BBP_BS_GROUP_BE for new document type and number range

    Hi gurus,
    I am working on Classic scenario in SRM and currently have used the above BADI to use a different document type and number range when creating the PO in the backend system. It all works fine. The only thing is I noticed that the BE_DOC_TYPE field in the shopping cart is still reflected as 'EC' even though the PO created in ECC is for example EC1. My question: Is this standard SRM? If so, is it common to leave this field as it is or is it advisable for us to change the document type to EC1 as well? Also, is there any implication in standard SRM reporting and downstream processes that you are aware of?
    Appreciate any advice on the above.
    Cheers!
    Sf

    We have ended up having to populate the document type on a custom field or alternatively replace the existing one.

  • Using SecureCRT or other terminal emulator application for Telnet of LMS

    Hi Everyone,
    How to I set SecureCRT/Hyperterm or other terminal emulator as the one that will be use to telnet a device from Device Center or Topology Services?
    Many thanks.

    For Device Center, it depends on which browser you use. If it's Mozilla/Firefox, it can be as simple as modifying the Helper application in the Preferences. Or if it's IE 7 or 8, you could modify the registry setting for the telnet:// protocol (see this post https://supportforums.cisco.com/message/670709), or alternatively replace the Windows telnet.exe binary with a shortcut to SecureCRT if you don't mind using the latter all the time.
    For Topo Service in Campus Manager, you need to create a campusmgr.properties file as described in http://www.cisco.com/en/US/docs/net_mgmt/ciscoworks_campus_manager/5.0/user/guide/cmugfull.pdf, and keep in mind of http://tools.cisco.com/Support/BugToolKit/search/getBugDetails.do?method=fetchBugDetails&bugId=CSCsa80409 that afflicts CM 4.0 and Windows 2003 and Windows XP clients.

  • How to change hard drive on MacBook

    How do I install a new hard drive on a MacBook  please

    •Mac Laptop Repair  Guides - iFixit:
    http://www.ifixit.com/Device/Mac_Laptop
    http://www.ifixit.com/Device/MacBook
    Depending on the identity of the product, details of the process
    will vary somewhat; and the data speed of the hard drive bus
    may affect alternative replacements, such as an SSD upgrade.
    Good luck

  • Suggest me less expensive SELECT for aggregate function.

    Hi,
    I hv a SELECT statement with AGGREGATE function, but, as aggregates are expensive, so, want to replace it with less expensive SELECT statement, so, pls. let me know it, Wht can i use instaed, code is as below,
    CLEAR my_amount.
      SELECT SUM( wrbtr ) into my_amount from BSID
                              WHERE bukrs = p_bukrs
                              and   kunnr = p_konto
                              and   budat <= sy-datum.
    so, pls. let me know alternative(replace) SELECT which is less expensive performence wise
    thank you

    >
    M_S_Raju_0613 wrote:
    > Hi,
    >
    > I hv a SELECT statement with AGGREGATE function, but, as aggregates are expensive, so, want to replace it with less expensive SELECT statement, so, pls. let me know it, Wht can i use instaed, code is as below,
    >
    >
    CLEAR my_amount.
    >   SELECT SUM( wrbtr ) into my_amount from BSID
    >                           WHERE bukrs = p_bukrs
    >                           and   kunnr = p_konto
    >                           and   budat <= sy-datum.
    >
    > so, pls. let me know alternative(replace) SELECT which is less expensive performence wise
    >
    > thank you
    I don't think using SUM is a bad thing to do if you're using an index.  The only replacement would be to select all the data into an itab and add it up yourself and I don't think that doing this would be any quicker - it might even be slower because you would be bringing back more records rather than restricting the number of records brought back at database level which is what the SUM would do.  The thing I'd be concerned about here is that you're not taking acount of the SHKZG debit / credit flag.  But if all the lines you're dealing are credits or all are debits that won't matter to you.

  • Can I force a full backup in Time Machine?

    I recently set up one of our users with a new iMac that came with OS X 10.9 Mavericks. Instead of getting their info by importing from a Time Machine backup, I set them up manually because they wanted a number of changes made to their account.
    Previously, this user had been on a MacPro running OS X 10.6.8 Snow Leopard. I used the same external drive that they had been using with Time Machine on the MacPro as their Time machine drive on the new iMac, via an Apple Thunderbolt to FireWire adapter, and didn't reformat it. When I turned on Time Machine in 10.9 it made a backup that took several hours, so I assumed it had made an initial full backup.
    They had a problem and I booted the iMac from the Recovery partition and selected to restore from a Time Machine backup. I was surprised that only two full backups showed, and both were of their MacPro with 10.6.8. We came up with another way to get the lost data back, but it was very time consuming. We were able to restore individual files from their Time Machine backups, just not able to do a complete restore of the drive.
    I double checked and nothing is excluded in the Time Machine System Preferences.
    I would like to be able to restore this user if they have a problem in the future, but it appears that unless I can force Time Machine to make a full backup that this may be impossible.
    Is there a way to force a full Time machine backup with the OS X 10.9.2 that they are now running?
    Thanks in advance for any help with this.
    Chuck Hildebrand
    Iowa Public Television

    If you have a spare, emptry hard drive of sufficient capacity, then you can clone the backup drive to the empty drive. Do not attempt to simply copy using Drag and Drop since there are invisible files you may inadvertantly omit.
    Clone using Restore Option of Disk Utility
      1. Open Disk Utility in the Utilities folder.
      2. Select the destination volume from the left side list.
      3. Click on the Restore tab in the DU main window.
      4. Select the destination volume from the left side list and drag
           it to the Destination entry field.
      5. Select the source volume from the left side list and drag it to
          the Source entry field.
      6. Double-check you got it right, then click on the Restore button.
    Destination means the empty drive. Source means the old backup drive.
    Alternatively, replace the backup drive with a new drive. This would be simpler than the above.

  • [ANN] Tired of the Curves effect's shortcomings? Here's a solution!

    Philipp Spöth of Frischluft.com has released an alternative/ replacement for AE's own not-so-sexy Curves effect, that has all the features you ever wanted in the version that comes with AE: the panel adapts to the size of the effects control window and thus can be very large, curves are smoothed and come in color and you have much more parameters to choose from. The latter includes the option to also drive curves with other curves, allowing for selective corrections. For the full Monty, go to:
    http://frischluft.com/curves/index.php
    Mylenium

    Well, it runs within AE's plugin API. So in all fairness, at least in that regard AE must be good for something. ;-)
    Mylenium

Maybe you are looking for

  • Error in starting OBIEE 11g BI services

    Hi, When i starting the BI services I am getting the following error in browser page. Error: Error 500--Internal Server Error From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1: 10.5.1 500 Internal Server Error The server encountered an unexpected

  • Black Ipod With Video is not recognized

    I searched the forums alot before posting. I was wondering whats up with my Ipod cuz my computer gives me the device failed to connect sound but no error message. The Ipod lights up when pluged into my comp but is not connected. It works on other com

  • Organize PDF docs on iPad?

    I have sent several PDF docs to my iPad, but I am unable to create folders to organize them into specific categories. Is it possible to do so?

  • How you can find out when someone using your icloud account

    how you can find out when someone using your icloud account

  • General settings for full hd 1080 cam

    hey, I have full hd 1080 cam avchd, and I don't know wich correct settings I need 2 use!!?? firtst of all: dv or hdv= I think hdv second: avchd I really don't know it any more and it's starting to get me ennoying