Problem in working with multiple cursors in pl/sql block

I want to develop a procedure to update the values of a colunm for each table.
Output of cursor (cur_ttbl)will be like :
Table Name column_name
Tab1 Col1
Tab2 col2
tab3 col3
Now see below code : In below code I want to append the logic to create a update script to update the table/column returned by first cursor.. I know we have to create a second cursor to go through each record and update that... please suggest the code to do same.
CREATE OR REPLACE PROCEDURE SOL_TEST(p_message_out OUT VARCHAR2,p_err_ind_out OUT NUMBER)
IS
CURSOR cur_ttbl IS
SELECT table_name,column_name
FROM port_table;
lv_SQL_Txt VARCHAR2(4096);
v_COLNM VARCHAR2(200);
BEGIN
FOR rec_ttbl IN cur_ttbl LOOP
v_COLNM := rec_ttbl.column_name;
-- Upper case A replacement
IF INSTR(v_COLNM,chr(63),1) <> 0
THEN v_COLNM := TRANSLATE(v_COLNM,chr(63),chr(42));
END IF;
-- Update the Clintrial record
lv_SQL_Txt := 'UPDATE ' || cur_ttbl.table_name || ' SET ' || cur_ttbl.column_name || ' = TRIM('||v_COLNM||'), ' ' WHERE '|| 'STATUS= 0 AND STAT= ' || '''' || 'N' || '''';
EXECUTE IMMEDIATE lv_SQL_Txt;
lv_SQL_Txt := 'COMMIT';
EXECUTE IMMEDIATE lv_SQL_Txt;
END LOOP;
p_err_ind_out := 0;
p_message_out := '''';
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
WHEN OTHERS THEN
p_err_ind_out := 1;
p_message_out := SUBSTR(SQLERRM,1,132);
END;
/

Devgan wrote:
I want to develop a procedure to update the values of a colunm for each table.To be brutally honest - I see everything wrong with this sample procedure and nothing correct.
It does not use exceptions. Exceptions are the de facto standard in modern language - not return codes and messages.
It does not use bind variables for the dynamic SQL created. That will result in a lot of hard parsing (that will reduce that loop's performance by 500% or more). It will also fragment the Shared Pool. A fragmented Shared Pool will cause memory allocation errors.
The data model, judging from the select and update, uses column and table names as attributes. That is a fundamental violation of data modeling and makes absolutely no sense at all in relational design.
Still, I suspect that you will ignore these issues (as it seemed was done and lead to this code) and persist in doing it this "+special+" way. In which case, try not to run too hard into the brick wall. And no, one cannot hack holes in that wall. It can only be removed by adhering to fundamentals - from relational design and physical database implementation, to design and coding in PL/SQL and SQL.

Similar Messages

  • Problem when working with multiple sequences

    Dears,
    In order to make life easier (I am currently working on a rather long project), I work with multiple sequences, one per chapter.
    My problem: I named one sequence "assembly sequences" in order to add the various sequences. I dropped the sequence no 1, then no 2. All works fine, beside that when playing the sequence no 2, I see two black lines on top and bottom of the screen for the all length of the sequence. Which is not the case when I click on the sequence itself and play it independently.
    Any idea how to solve this ?
    Thanks
    Nic

    Thanks, what happened is that :
    1st sequence is like this : Frame size 720x576 pixels, video rate 25fps, Compressor DV-Pal. And I think it is the one appropriate for me and my country.
    2nd sequence is like this : Frame size 720x480 pixels,
    video rate 29.97 fps, Compressor DV-DVPRO-NTSC.
    I think I should change the second sequence setting, but can I do it after all the work I have done, and continue making a 3rd, 4th and so on ?
    Tx for your precious help,
    Nicolas

  • When working with multiple artboards, are there separate layers panels for each artboard?

    Just started working with multiple artboards in ai but have read nothing about the layers panel, whether you use one layers panel for all the artboards or if the layers panel is duplicated so there is one for each artboard.

    I don't really understand your problem, but I've had headaches with managing a GUI before (as many programmers have, I'm sure).
    My best advice, if the scheme your using to build and manage a GUI is too confusing for you, the programmer, to easily understand/manage, change the scheme. Even if this means recoding a good deal of your program (though, hopefully, you've kept the GUI as seperate from your functional code as possible) it should be worth it.
    Perhaps a clearer explination of your problem would help better illustrate your problem?
    -Rejun

  • Working with Multiple Files in Workspace Layout

    If I was working with multiple files in the workspace layout, they each used to be available for selection from a tab.  Now I can either cascade the files horizontally or vertically - but not have them appear in a tab across the top of the workspace layout.
    Does anyone know how to set the workspace to present multiple files in tabs?  I have CS3.

    Tanya,
    This may not help, but the times when that happens to me is when I go too fast and some operations haven't finished. I then try to select a file that hasn't completed and the file I select is in the process of having the data updated. The worst is when it is trying to render as I am doing something.
    I hope this helps some.
    Mel

  • Problem in working with Japanese data

    Hello,
    We have an application, which should work for both English and Japanese languages. Our application is working fine for English data but in case of Japanese, we are facing problems. In the application, there is a language setting, where the user can select either English or Japanese. This changes the language of the labels to English or Japanese. We are handling this thru' ResourceBundles. But the data that is entered can be independent of this. In English setting also, the data entered or diplayed could be Japanese. Now we are facing problems at vaious places -
    1. When we enter Japanese data and save it, it gets copied into the bean and if there is any error in the saving, the same data from bean comes back on the screen. This data doesn't appear properly in Japanese.
    2. When we try to retrieve the already saved data from database, it doesn't show poperly in Japanese.
    We are using our own 'toUnicode' function, which converts the data to Unicode before saving the data to database. Similarly, we have tried different encodings like SJIS / Shift_JIS / ISO-2022-JP at various places i.e. in 'Page' directive or in HTML Meta tag or various combinations of these two. Nothing is working reliably. Sometimes for some combination, data retained in the first case is correct but it can't be saved. Sometimes it works with Unicode, sometimes without Unicode. Some combination affects the Japanese labels as well. Otherwise the labels at least are displayed properly.
    The same code with just Shift_JIS setting in 'page' directive, worked well in IIS Server for both English and Japanese.
    What could be the problem in WebLogic? Does it matter if WL is installed on English or Japanese machine?
    Kindly answer ASAP, since the project is getting delayed.
    Thanking in anticipation...
    -Medha

    Hi,
    is there a difference in handling Japanese and Chinese chars? If not I
    might be able to give you some hints.
    Daniel
    -----Original Message-----
    From: JSB [mailto:[email protected]]
    Posted At: Monday, February 12, 2001 6:22 PM
    Posted To: internationalization
    Conversation: Problem in working with Japanese data
    Subject: Re: Problem in working with Japanese data
    Have u solved this yet, and how ?
    Medha <[email protected]> wrote in message
    news:[email protected]...
    >
    Hello,
    We have an application, which should work for both English andJapanese
    languages. Our application is working fine for English data but in case
    of
    Japanese, we are facing problems. In the application, there is a
    language
    setting, where the user can select either English or Japanese. This
    changes
    the language of the labels to English or Japanese. We are handling this
    thru' ResourceBundles. But the data that is entered can be independent
    of
    this. In English setting also, the data entered or diplayed could be
    Japanese. Now we are facing problems at vaious places -
    1. When we enter Japanese data and save it, it gets copied into thebean
    and if there is any error in the saving, the same data from bean comes
    back
    on the screen. This data doesn't appear properly in Japanese.
    2. When we try to retrieve the already saved data from database, itdoesn't show poperly in Japanese.
    We are using our own 'toUnicode' function, which converts the datato
    Unicode before saving the data to database. Similarly, we have tried
    different encodings like SJIS / Shift_JIS / ISO-2022-JP at various
    places
    i.e. in 'Page' directive or in HTML Meta tag or various combinations of
    these two. Nothing is working reliably. Sometimes for some combination,
    data
    retained in the first case is correct but it can't be saved. Sometimes
    it
    works with Unicode, sometimes without Unicode. Some combination affects
    the
    Japanese labels as well. Otherwise the labels at least are displayed
    properly.
    The same code with just Shift_JIS setting in 'page' directive,worked
    well in IIS Server for both English and Japanese.
    What could be the problem in WebLogic? Does it matter if WL isinstalled on English or Japanese machine?
    Kindly answer ASAP, since the project is getting delayed.
    Thanking in anticipation...
    -Medha

  • Problem in working with Video

    I have problem in working with Opening and editing video
    When I tried to open :
    Could not complete your request , because it is not right kind of document [ for every format of video ]
    When I import as video :
    it creates as many layers as there are frames in the video
    Please help
    Thank you

    Video is like Image formats, but on steroids. Also, many formats, such as AVI can have 100's of different CODEC's inside them. It is almost like having a JPEG, that contains a TGA, or a TIFF, or a PCX, or any number of what we see as other formats. It can be daunting, but let's start at the beginning.
    For a discussion on formats, such as AVI, MOV, WMV, etc., see this article: http://forums.adobe.com/thread/440037?tstart=0
    As CODEC's are the "building blocks" of AV files, this article is good too: http://forums.adobe.com/thread/546811?tstart=0
    As you see from that first link, the format is just a "wrapper," and can contain all sorts of "stuff." That FAQ Entry will tell you how to "peek inside" the wrapper. That is what we need, as Mylenium asks. If you can let us know all about the faulting files, maybe someone can help you.
    Also, PS has somewhat limited Video support, both on Decode and Encode, so, and depending on what you have, you might have to convert that/those file(s).
    Good luck,
    Hunt

  • Working with  multiple layers in CS 3 ?

    In order to work with multiple layers in cs3, I first need to open few images to work with,and when I open few images it only shows last image that I opened.Frist images can't be seen in workspace, and when I open new document I can't see not even one photo I opened?

    try tapping the F key a few times until you get to the screen mode that allows you to see all image windows.

  • Does WRT54GP2 work with multiple ViOP providers ?

    My question is, Does WRT54GP2 router work with multiple ViOP providers ? Can I use it with a ViOP provider other then Vonage ?
    Thanks, John

    Yes you definately can , all you need is a VOIP adapter that supports SIP . It's a standard protocol and is supported by all routers and VOIP providers

  • Problem when working with package???Please, help me!!!

    I got 3 .java files from one Java tutorial as follow:
    Server.java (in package mygame.server)
    Utilities.java (in package mygame.shared)
    Client.java (in package mygame.client)
    All the above files are placed in "E:\Java Programmes\source"
    After compiling, i got correspponding .class files:
    Server.class (placed in "E:\Java Programmes\class\mygame\server")
    Utilities.class (placed in "E:\Java Programmes\class\mygam\shared")
    Clients.class (placed in "E:\Java Programmes\class\mygame\client")
    But when i run Server.class which contains main method, i got error as follow:
    E:\Java Programmes>java class\mygame\server\Server
    Exception in thread "main" java.lang.NoClassDefFoundError: class\mygame\server\S
    erver (wrong name: mygame/server/Server)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    That was very puzzled for me. I cannot find out what wrong with my files. Please., any boby, help me!!! I always got this problem when working with package and managing files. Thanls a lot.

    java -cp "E:\Java Programmes\class" mygame.server.Server

  • Reg:working with multiple windows in webdynpro-abap

    Hi ,
    How can we create multiple windows and how can we link them...
    suppose we have 3 fields on first screen .how to move the data from the first screen to second screen..
    Thanks & Regards
    Suman Puthadi

    Hi
    As per your Subject you are looking for "working with multiple windows in webdynpro-abap" and for abap there is a different forum. Web Dynpro ABAP
    Hope its clear to you...
    Even you can read this post when ever you get time Read before posting
    Regards
    Ayyapparaj

  • Nexus 1000V. problem when working with the console VMWare

    I have a problem when working with the console VMWare.
    Sometimes it is impossible to connect any of the hypervisor to the guest OS managed by them.
    I get the message: "Unable connect to the MKS: Host address lookup for server <name of the hypervisor> failed: No such host is known."
    This message always appears in conjunction with the reconfiguration of virtual switch: "Reconfigure vNetwork Distributed Switch .... Initiated by Cisco_Nexus_1000V_ ....."
    Upon completion of the reconfiguration, Communication console, with guest OS is restored, or on its own or after a reboot srv-vc.
    In this time, I do not see any message in Nexus 1000v log.
    What is this?
    Thanks in advance.

    Smells of a DNS issue.  Are you sure your ESX hosts are reachable from your client via DNS hostname?  Try pinging them from a command prompt/terminal.  You may have DNS server issues.
    As a temp fix, edit your [windowspath]/system32/etc/drivers/hosts file and manually add the ESX host name and IP, then re-test.
    Regards,
    Robert

  • Why is scrolling not working with multiple youtube embeds layed out vertically in a stack on one page?

    Why is scrolling not working with multiple youtube embeds layed out in a stack on one page?

    Hi ,  
      This is a sort of performance issue , because your program takes more than the max time set for the program to execute in foreground.
    There are many stuff in program which will hamper your performance.
    I will list down a few
    1. SELECT *
    FROM konp
    INTO CORRESPONDING FIELDS OF TABLE konp_itab
    FOR ALL ENTRIES IN a363_itab
    WHERE knumh EQ a363_itab-knumh
    in this statement you are using for all entries a363_itab , but before this statement you are not checking if the table has any entry or not , please do remember that for all entries has this characterstic , that if you internal table does not contain any record , then all the records are selected from the database table. So in this case if you table a363_itab is empty , so what you want is no data must be seelcted from table konp , but what will happen is all the records in KONP will be seelcted.
    2. While retreiving data you are using seelct * even though you do not require all the fields , an example is
    <b>SELECT *
    FROM mkpf
    INTO CORRESPONDING FIELDS OF TABLE mkpf_itab
    FOR ALL ENTRIES IN mseg_itab
    WHERE mblnr EQ mseg_itab-mblnr.</b>
    in this your internal table contains only 2 fields
    <b>mblnr LIKE mkpf-mblnr, "Number of Material Document
    bldat LIKE mkpf-bldat, "Document Date in Document</b> , but to get these 2 fields you are selecting all the fields of the table.
    3. In select you are using into corresponding fields of table , it is not a good practice., so please avoidd it.
    Please understand that you must try to reduce the access to your database tables and try to keep it minimal , because this same thing may happen becasue data in DEV is very less compared to the volume of data in production , so a program working in DEV will take much more time in PRD if not written properly and may result in timeouts , as in your case.
    Please try to make chanegs to the prorgam and see if it works.
    In case you have more queries , please do revert back.
    Regards
    Arun
    *Reward points if replay is helpful

  • Maintain performance while working with multiple shape layers (~50 )

    Hey guys, I've been working on some projects lately where I need to animate a lot of shape layers cascading, arraying, with various animation properties. When I get to the point of using 30-60 or so shape layers, and they're all doing some kind of scale, position, etc. animations, my computer slows to a complete crawl. This then forces me into using a single shape layer and the repeater functions. These can work well sometimes, and don't hamstring the flexibility too much, UNTIL you need to incorporate varying colors. At that point, I usually switch my shape layers to masks and place a layer below with varying colors as needed. The shape animations then reveal those colors, but this doesn't work for a complex object that in itself requires many colors. Sooo...
    What kind of workflows do you all have for working with multiple semi-complex objects at once? I figure I must be missing something, because this has gotten really limiting. Is everyone just working with 256GB of RAM?
    FYI, my computer specs are:
    2 x 2.66 GHz 6-Core Intel Xeon
    32 GB 1333 MHz DDR3 ECC
    ATI Radeon HD 5870 1024 MB
    OS X 10.9.4 (13E28)
    Thanks!!

    Pre-comping can speed up your previews if you are using disk cache, but nothing will speed up  your first ram preview or a ram preview after a keyframe change except a better optimized system. All it takes to slow things down is one effect or a footage file that causes AE to start consuming memory and processor power.
    As a test I just created a gradient filled rectangle, added rotation keyframes, duplicated the layer so I have 64 copies on my Mac Mini and tried a ram preview compared with the same comp with only 1 layer. Almost no difference in the time it took to preview 10 seconds. Threw in a scale transform for all layers and again, not much difference between one shape layer and 64. To make things much harder I change the rectangle to a Polystar and animated everything in the Polystart transform properties, set up a composition with 128 duplicates and a comp with one layer. 2.5 seconds for a ram preview at quarter rez for a single layer, 10 seconds for a ram preview for 128 layers. That's more than acceptable to me for a two year old Mac Mini with 16 gb of ram. Increasing the zoom factor to 50% with Resolution set to Auto doubled the ram preview time which was still acceptable.
    This makes me wonder what else is going on in your composition. Any effects or other things going on? Have you optimized your system for maximum performance? There are links with suggestions for doing that all over this site as well as the Adobe recommendations found here: Optimizing After Effects Performance

  • Problems While Working With CLOB fields

    HI Friends,
    I am facing one big problem while working with CLOB fields. I work in crystal reports in my project and My team is works in BMC Remedy tool. As per database configuration by default the date fields are stored in numbers. There is a field named Work Log which stores the complete history information of a ticket or a call.
    While generating reports I convert the date fields from numbers into date values by using to_date function. But I am not able to change the dates mentioned in the worklog which is a CLOB field. As a result when I am generating reports text part of the work log is comming fine but the date fields are comming in numbers.
    Please refer the below example:-
    *1291012455anilkumarptesting*
    Full Name:
    PRG Name - EUC-APP PKGN1291012585anilkumarptesting
    Full Name:
    PRG Name - EUC-APP PKGN1291012631anilkumarptest
    Full Name:
    PRG Name - EUC-APP PKGN1291207510anilkumarpfd
    Full Name: Anil Kumar Pantangi
    PRG Name - Prod_Ops1291207535anilkumarpf
    Full Name: Anil Kumar Pantangi
    PRG Name - Prod_Ops
    Assignment notification disabled for this transaction1291212517kapilbasd
    Full Name: Anil Kumar Pantangi
    PRG Name - Prod_Ops
    See the first line of the worklog "1291012455anilkumarptesting", 1291012455 is referring a date value, but due to database configuration it's comming in number. All the other numbers in the above text are dates only which need's to be converted. These dates are captured in remedy tool when someone updates that ticket.
    I am not able to decide how to change this numbers into dates. As it is containing lot's of numbers i am really confused how to come with a solution.
    Can I expect a solution from you, atleast a way how to proceed resolving this problem. Should I have to write a procedure for this??
    Please help..........
    Kindly let me know if you need any more input.
    Regards,
    Arijit

    937670 wrote:
    1291012455 represents a date value,What date value does it represent? Since it's not obvious to us what date you want that converted into, it's obviously hard for us to help. For example, perhaps you want that to be Jan 29, 2010 with "12455" representing a time component in some non-obvious format. Perhaps you want that to be December 1991 at 1:24:55. Perhaps you want to convert it to a completely different date. You're going to need to tell us in words how to convert your numeric data into a date.
    My question is how can I convert all the numbers into date in the CLOB field and present it in a proper manner.Given your sample data, what do you expect the output to be? Do you expect many rows of data, one for every date in the CLOB? Do you expect a comma-separated list? Something else?
    Justin

  • How do icloud and itunes match work with multiple libraries?

    How do icloud and itunes match work with multiple libraries?

    This forum is for troubleshooting compatibility issues between Macs and Windows, not iTunes. You'll probably want to repost your question in the iTunes discussions:
    http://discussions.apple.com/category.jspa?categoryID=150

Maybe you are looking for

  • New LR 4 on Windows VISTA 64 bit system fails to load. Error message says MSVCR100.dll was not found

    I reloaded LR and tried to "repair" it x2. Same error and it will not open. Can I try to download the trial version and use my serial number, return the product or is ther something simple I can do. Thanks

  • Crash on launch on Nexus 5

    Firefox crashes on launch. Brand new Nexus 5, all other applications seem to be working fine,

  • IPod begins to sync and syncs some songs, then just stops.

    I just bought this iPod last night from a friend. When I tried putting the music from my iTunes onto it, it repeatedly stops syncing the songs and the screen changes from saying Synchronizing to Connected. I've tried restarting, restoring, updating i

  • Persistent Essbase Crashes

    For about four years now, we've experienced consistent essbase app\dblock ups and server crashes. The Essbase db's stop responding and we're forced to bring down the Essbaseserver and start it up again. (Sometimes even forced to reboot the Windows 20

  • Promlems re-installing CS4

    Hello. Ive been using CS4 Design Premium on a MacBook Pro for a while now, but have recently had a major problem. I installed CS4 on my Mac Book Air...at weekend (downloaded from Adobe)...keyed in serial number - working fine. I then tried a clean in