change the loop condition and cursor

Hi all

We have the procedure below:

PROCEDURE ext_UPLOAD IS

v_colname VARCHAR2 (30);

v_tl_colname VARCHAR2 (30);

v_stmt VARCHAR2 (32767).

v_stmt_no NUMBER;

CURSOR DISTINCT_COLUMN IS

SELECT DISTINCT T_STG DB_COL;

BEGIN

v_stmt_no: = 5;

FOR DBCOL IN DISTINCT_COLUMN

LOOP

v_colname: = DBCOL. DB_COL;

v_stmt_no: = 10;

v_stmt: = ' MERGE IN EXT_B ED

WITH THE HELP OF)

SELECT TAG_DATA,

EQUIPMENT_FK_KEY,

WORKORDER_FK_KEY,

SEGMENT_FK_KEY,

SHIFT_WORKDAY_FK_KEY,

HOUR_FK_KEY,

ITEM_FK_KEY,

READ_TIME,

ATTR_GROUP_ID,

RECIPE_NUM,

RECIPE_VERSION,

NVL (FND_GLOBAL. User_Id,-1) l_updated_by,.

NVL (FND_GLOBAL. Login_Id,-1) l_last_update_login

OF MTH_TAG_READINGS_T_STG

WHERE DB_COL = ' | " ' || v_colname | " ' ||') TS

WE (';)

v_stmt: = v_stmt | "ED. EQUIPMENT_PK_KEY = TS. EQUIPMENT_FK_KEY AND

ED. READ_TIME = TS. READ_TIME)

WHEN MATCHED THEN

UPDATE

GAME ED.'. v_colname |' = TS. TAG_DATA,

ED. LAST_UPDATED_BY = TS.l_updated_by,';

v_stmt: = v_stmt | "ED. LAST_UPDATE_LOGIN = TS.l_last_update_login

WHEN NOT MATCHED THEN

INSERT ('| v_colname |', EXTENSION_ID, EQUIPMENT_PK_KEY, WORKORDER_FK_KEY, SEGMENT_FK_KEY, SHIFT_WORKDAY_FK_KEY, HOUR_FK_KEY, ITEM_FK_KEY, READ_TIME, ATTR_GROUP_ID, LAST_UPDATE_DATE, LAST_UPDATED_BY,';)

v_stmt: =.

v_stmt | ("LAST_UPDATE_LOGIN, CREATED_BY, CREATION_DATE, RECIPE_NUM, RECIPE_VERSION)

VALUES (TS. TAG_DATA, EGO_EXTFWK_S.NEXTVAL, TS. EQUIPMENT_FK_KEY, TS. WORKORDER_FK_KEY, TS. SEGMENT_FK_KEY, TS. SHIFT_WORKDAY_FK_KEY, TS. HOUR_FK_KEY, TS. ITEM_FK_KEY, TS. READ_TIME,';

v_stmt: = v_stmt | "TS. ATTR_GROUP_ID,' | '''|| SYSDATE | "'| ', TS.l_updated_by, TS.l_last_update_login, TS.l_updated_by,'|"' | SYSDATE | " ' ||', TS. RECIPE_NUM, TS. RECIPE_VERSION)';

mth_util_pkg.log_msg ('v_stmt: ' | v_stmt, mth_util_pkg.) G_DBG_DYN_SQL);

-DBMS_OUTPUT. Put_line (v_stmt);

v_stmt_no: = 20;

EXECUTE IMMEDIATE v_stmt;

-VALIDATION;

END LOOP;

EXCEPTION

WHEN INVALID_NUMBER THEN

RAISE_APPLICATION_ERROR (-20008,'The Data Tag you are tyring to insert the character data is.) A number should instead. ") ;

WHILE OTHERS THEN

RAISE_APPLICATION_ERROR (-20008, SQLERRM |' to ' | v_stmt_no);

END;

In above query we conduct cursor on DB_COL OF DIFFERENT T_STG, but the above query fails if we have the same db_col, but for groups of different attributes. I want the merge request and loop to work for separate but with given db_col ATTR_GROUP_ID as I have attr_group_id 10 and 20, but two of them may have db_col as n_ext_attr1 and slider should be for db_col and also take into account attr_group_id. can you be it someone please let me know how to change the cursor above and also the loop as well as db_col and attr_group_ ID the two are taken into account.

Thanks in advance.

Maybe you need to take a step back and explain exactly what you're trying to reach, providing tables of the example and example, the production of these data in the example data.

No offence not intended, but your statement dynamic MERGE is not well written, completely does not use bind variables (and why you think concatenating SYSDATE in a stirng as it will work properly, I don't know), and will be a nightmare to maintain in the future.  I'll ignore for now the use of waste from other exception ONCE (even if it's really cr * p coding) you clearly bigger problems to solve first.

Thus, in addition to providing some data and tables of the example can answer you, why you do not know the names of the columns you try to merge?

The mention of the ATTR in your instructions seem to feel a bit as if you use a type of entity-attribute-value architecture to your database, is this true? I hope sincerely that no, since it is known to be a performance killer and a nightmare to code and maintain when it comes to relational database engines. (I have a personal experience of having been victims of such a database design, and fortunately, we managed to convince management that the product was not fit for purpose and it was abandoned within months purchased (if only we could see before purchase)!)

Tags: Database

Similar Questions

  • Change the font size and clock color

    Hello

    I would like to change the font color and size where I see blue fonts or light gray on the desk clock. Looks like a selection here would, but I don't know that we apply to the clock. Any suggestions?
    It is Vista Ultimate 64-bit SP2
    Beginning
    Parameters
    Control Panel
    Customization
    Windows color and appearance
    Advanced appearance settings
    Apperaance advanced
    Agenda

    Thank you
    Frank C

    If it's the clock gadget, I don't know of any way to change those but there are 7 other clocks that you can choose with color and different fonts. You can see the first clock. To change the clock opens the gadget options box (place the cursor on the clock > click on the key icon) and click on the small directional triangles on the bottom of the clock.  I hope I could help

  • less than or equal to the loop condition

    Hello

    What do you prefer, what's the most common one is more easily readable, less or equal in the loop condition?
    for (int i = 0; i < arr.lenght; i++){..}
    //or
    for (int i = 0; i <= arr.lenght - 1 ; i++){..}
    I know it's basic programming and nothing to do with Java, so if this forum is not for this, could you please suggest a general programming forum?
    I would really appreciate that I have a lot of General questions :)

    Thanks in advance,
    lemonboston

    lemonboston wrote:
    Hello

    What do you prefer

    Personal preferences, which is useless for you

    which is more common,

    From the years of reading code open source, the first

    one who is more easily readable, less or equal to the loop condition?

    Personal opinion, which is useless for you

    I would really appreciate that I have a lot of General questions :)

    If you don't want to think about yourself (which you should do instead of asking general questions), just lazily attack. The two examples reach exactly the same, but the first is less to type and read.

  • How to use OMB to change the filter conditions in OWB maps

    Hello
    I want to know how we can use the OMB to change the filter conditions in an OWB map.

    In my scenario, I have a filter FLTR_1 operator in my cards and I need to change the filter condition of


    INOUTGRP1.ID IN (1,2)
    AND
    INOUTGRP1. VALUE > CONST_0_MAX_VAL

    TO

    INOUTGRP1.ID IN (1,2)
    AND
    INOUTGRP1. VALUE > CONST_6_MAX_VAL


    Just for more information for everyone we are migrating from OWB 9.2 10.2 OWB and we called constant procedures and used their values in filter conditions. 10.2 OWB generates the values for the constants in a way different than OWB 9.2 which is why this change is necessary. I want to automate the Act of changing the names of constants so that we can save time to change maps.

    THX

    Hello

    change in the framework of your database module, then try

    OMBALTER MAPPING 'MY_MAP' MODIFY OPEARTOR 'FLTR_1' SET PROPERTIES (FILTER_CONDITION) VALUES ('INOUTGRP1.ID IN (1,2) AND INOUTGRP1.VALUE > CONST_6_MAX_VAL ')
    

    Kind regards
    Carsten.

  • Change the page size and text in Firefox 35.0.1

    I had a small red P at the top right of Firefox that changed the page size and the fonts that I lost after a reset: How do I get it back?

    Do you mean this extension?

    You can check the "Old data Firefox" folder on the desktop to see what extensions you previously had.

  • A way to change the font, size and "BOLD" to each page?

    Due to problems described here https://support.mozilla.org/en-US/questions/1012057?esab=a & s = & r = 0 & as = s I erase that I need something (an extension, perhaps) I want to recognize and change the font size and "BOLD" fonts in each page.
    Is there something like this?
    Maybe also for the bookmarks bar...

    You can use the NoSquint extension to define the size of the font (zoom text/page) and the color of the text on web pages.

  • Can I change the new memory and at the same time to replace the Rams?

    Can I change the new memory and at the same time to replace the Rams?

    If a MacBook Pro RAM and drvie hard can be modified/improved depends on the submodel and we do not know yours. There are dozens of variations of the MacBook Pro issued since 2006, and you do not want guessing us!

    Please do "about this Mac" in your Apple menu to get this:

    Notice the line that I have highlighted with the red arrow. Please tell us what your computer has in the thr same place. However, do not post any serial number.

    With the exact submodel we can better advise you of any available upgrade paths.

  • Satellite 1900-303: changed the BIOS settings, and now I can't boot from the CD drive

    Can anyone help, I inadvertently changed the BIOS settings, and now I can't get the CD player to boot the pc back to the default settings, Windows xp seems to work ok as is the cd player.
    If someone has the original settings, I would be grateful for any help.

    Derek has soon

    Hello Derek

    Use the F2 key to enter the BIOS settings and change the order of boot devices. This option is under the STARTUP tab. Otherwise, you can insert the recovery CD when the unit is turned OFF. Turn it on and immediately press the C button. keep it down for a few seconds and unit is forced from the CD/DVD drive.

  • How to change the secret question and answer if I've forgotten my email of rescue?, how change the security question and answer and if I've forgotten my rescue by email?

    How to change the secret question and the answer if I've forgotten my email to rescue?

    You have to ask Apple to reset your security questions. To do this, click here and choose a method; If this page does not list one for your country or if you are unable to call, complete and submit this form.


    (137073)

  • Change the screen startup and connection to the new theme

    How can I change the screen startup and connection to a theme driven as something the matrix? I know that some people have created programs that can do this, but prefer to stay with microsoft to do this, if possible.

    Microsoft is not all programs that allow you to do.

  • I changed the hard drive and was invited to provide an activation code in order to achieve the functioning of the operating system

    I had problems with my PC which is an old, 2003 E - business machines, I changed the hard drive and was invited to provide an activation code in order to achieve the functioning of the operating system, it is the third time that I had to do it in 2 years, a message came back to me that I could use this activation key which is Microsoft XP Home Edition... any suggestions I'm a student who can't afford to keep buying these keys to get my PC running, I have homework to fill out online... Please help

    Use telephone activation, say nothing, and you will possibly connected to a human being.  They should be able to sort out you.

  • my fonts disappeared! When I go to change the system fonts and fixedsys... What do I do?

    I use Vista Home Basic and a little more than a month I've had problems with the script!  All the lines and symbols... I have restored until I can't do a day earlier that when this problem happened!  Finally, I changed the standard windows fonts and I use somethings, but much is still in the symbols (dashes, lines, etc.).  I went into my fonts folder in Control Panel and my folder is empty!  When I go to change the system fonts and fixedsys... What do I do?

    Hi Vickie,

    If you see only the fonts system and no additional (specific program) installed fonts, then you can try the following steps and check.

    Most likely, the fonts are installed on your computer are hidden. Did the same by following these steps.

    Method 1:

    a. open fonts by clicking the Start button, clicking Control Panel, appearance and personalization, and then clicking fonts.

    b. now click organize , and then click on folder and search options.

    c. click the display and check to select Show hidden files, folders and drives.

    d. click apply and OK. Check if you see all the fonts.

    (Make sure that show you the files hidden after the repair is done by selecting don't show hidden files, folders and drives.)

    Method 2:

    Try to perform the clean boot procedure and check if it helps.
    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7

    After the troubleshooting steps, please refer to clean the boot link to put the computer to normal startup mode.

    For more information, you can also read the following article.

    The problems of fonts

    You can also read the following article and check.

    Fonts: Frequently asked questions

    Hope this information is useful.

  • I changed the font size and now its great. When I went to change back the change back window font size is large.

    I changed the font size and now it is great.  When I went to customize to change the size of the font to its original size the window change size s now at large and I can't click on the OK button.  How to make the window smaller so I can change the font size?

    Dennis & ConnieCashion, Hi

    I suggest that you change the font size according to your requirement, then press enter once the changes have been made.

    Additional information:
    Change Windows fonts
    http://Windows.Microsoft.com/en-us/Windows-Vista/change-Windows-fonts

  • How to change the brightness, contrast, and color in the photo viewer in Windows 7?

    Change the brightness, contrast, and color in the photo viewer in win 7?

    How to change the brightness, contrast and color in the windows photo viewer 7 (I used the fix option in xp and vista)
    Thanks for any help.

    Hi epse30,

    In Windows Vista Windows Picture and Fax Viewer has been replaced by the Windows Photo Gallery and there was an option to set the brightness, contrast, etc by using the Fix as you said.

    Unfortunately, this option is not available with the Windows Photo Viewer in Windows 7.

    However, Windows Live Photo Gallery has a number of easy to use tools for things like red eye fixing or clearing exposure and low light situations. Windows Live Photo Gallery gives you more creative control over your photos. You can download Windows Live Photo Gallery for free from the link below;

    http://download.live.com/Photogallery

    Access the link below for more information about editing photos with Windows Live Photo Gallery

    http://Windows.Microsoft.com/en-us/Windows-Vista/editing-photos-with-Windows-Live-Photo-Gallery

    The above article is for Windows Vista, but it remains valid for Windows 7 as well.

    Varun j: MICROSOFT SUPPORT
    Visit our Microsoft answers feedback Forum
    http://social.answers.Microsoft.com/forums/en-us/answersfeedback/threads/ and tell us what you think

    If this post can help solve your problem, please click the 'Mark as answer' or 'Useful' at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • I changed the hard drive and now windows 7 is to say that it is not authentic

    I have a very big problem...

    I changed the hard drive in my laptop because he was dying and move all the files etc on the new hard drive. with the help of a friend of technique. He put his product key on my computer, after that I told him mine is on the bottom of the laptop. Now, I can not change the product key and troubleshooting for the network will not work and the folder of photos I have to right click to 'place to open the folder "... I don't want to format and start over as all my work is on the disc.

    I spend some time on the internet and well I get the thingies "your windows 7 is not valid" and well I'm getting so sick of it. I do what they say and they come up with nothing...

    Can someone please?

    Skarlette

    The common cause for these mismatches is a defective Intel Rapid Storage Tech driver

    Download and install the latest version of...

    https://Downloadcenter.Intel.com/Detail_Desc.aspx?DwnldID=22194

    You need

    iata_enu.exe

    Restart then run another report MGADiag and display the results

Maybe you are looking for

  • IPads have two outputs

    I use an app that plays back "multi-way" called reading. It has a feature called auto pan which has a toggle button, but when I turn IT says, "Only works with 2 iPad release." My iPad 2 Air apparently has this feature, but the iPad 2, that they have

  • Manual Sony RX100?

    I was just notified that my RX100 shipped from Pennsylvania yesterday, July 18, so I'm looking forward to read the user manual to get ahead. But in an online review, it has been said that Sony only provides a "getting started" booklet and a document

  • cant logon error messagesaid username or password is incorrect, but is not

    Try to connect to windows vista error message saying login or password is wrong but I know it's not how can I make my computer

  • Is there a way to group windows so that clicking on a button, they all appear?

    I have a setup where I have three Windows Open (a half on-screen OneNote window and two Windows Word quarter screen).  I usually need to all be open at the same time, but I find myself constantly spend away from internet or walkmans or similar browse

  • BlackBerry Smartphones Blackberry 10

    Good afternoonI recently bought a handset for BB9900, I think that the year next BB will come out a new operating system, BB10. It will be just for new devices or will it be an opportunity for current owners like me the opportunity to upgrade their c