Cursor problem

Hi all,
i am attempting to load a file into a batch table thru sql*loader..records have been loaded successfully..based on this batch table data i need to insert full data into weekly_content table.In this table there is one extra column that is not be in batch table and file.
we need to populate data logic based on the prodcategory column in batch table
batch table data is like this
id contenttype prodcategory title     default_item item_created_dt_part1 item_created_dt_part2
1 prod beauty     cosmetics cospuf 2007-11-08 10:22:20 013      
2 prod beauty cordless washable 2007-11-08 11:30:15     320
3 prod beauty sonicare replacement 2007-11-08 12:52:52 370
4 prod cooking nesco roaster 2007-11-09 11:15:34 953
5 prod cooking wolfgang pulp 2007-11-09 13:05:46 850
6 prod cooking collection Tim 2007-11-09 15:09:23 134
and so on
based on this data, i have written a cursor to populate the data
declare
cursor c1 is select contenttype,prodcategory,titile,default_item,item_created_dt_part1,item_created_dt_part2,id---system generated seqence
from batch_table order by lower(contenttype),lower(prodcategory),item_created_dt_part1,item_created_dt_part2,id
contentvar batchtable.contenttype%type;
prodvar batchtable.prodcategory%type;
titlevar batchtable.title%type;
defaultvar batchtable.default_time%type;
itemdtpart1 batchtable.item_created_dt_part1%type;
itemdtpart2 batchtable.item_created_dt_part2%type;
idvar batchtable.id%type;
a number(4);
b varchar2(15);
begin
for rec in c1
loop
select lpad(s1.nextval,2,'0') into a from dual;
b:=rec.ename||a;
insert into weekly_content(id,contenttype,prodcategory,prodname,title,default_item,item_created_dt_part1,item_created_dt_part2)values
(rec.id,rec.contenttype,rec.prodcategory,b,rec.titile,rec.default_item,rec.item_created_dt_part1,rec.item_created_dt_part2);
end loop;
end;
I want the output is like this in weekly_content table
id contenttype prodcategory prodname title     default_item      item_created_dt_part1 item_created_dt_part2
1 prod beauty     beauty01     cosmetics cospuf 2007-11-08 10:22:20 013      
2 prod beauty beauty02     cordless washable 2007-11-08 11:30:15     320
3 prod beauty beauty03     sonicare replacement 2007-11-08 12:52:52 370
4 prod cooking cooking01     nesco roaster 2007-11-09 11:15:34 953
5 prod cooking cooking02     wolfgang pulp 2007-11-09 13:05:46 850
6 prod cooking cooking03     collection Tim 2007-11-09 15:09:23 134
and so on
Objective is to create prod category values from 1 to 3 in the order they are created.the priority of assigning 1 thru 3 will be decided by item_created_dt_part1,item_created_dt_part2,id.
and while loading into the weekly_content table append a 2 digit number value to prodcategory from batch_table in the order i insert into the weekly_content table and insert into prodname column.
item_created_dt_part2--nano seconds
Could you please check the logic and recorrect it and send me.can any one please do favour in this regards..
Thanks in advance

What about this requires either a cursor or a loop?
Every tool in the world is not a hammer.
What you have here is:
INSERT INTO ...
SELECT ... FROM ...
Nothing more.

Similar Messages

  • XY Graph Cursor Problem in Labview 7.1.1?

    Hallo,
    I am  using Labview 7.1.1 and I am facing one problem with XY graph cursor. If I am moving cursor in one graph, I am expecting same movement in another Graph. But when I move cursor in Graph1, cursor in second graph moves but not to exact X value of Graph1.
    Property of Cursor in both graphs must be "Lock to Plot"
    If any body knows about this please let me know ASAP. I am attaching example VI for your reference.
    Thanks,
    Sashi
    Attachments:
    XY Graph Cursor Problem.vi ‏101 KB

    It's a curious effect. Probably the floating point coordinate is sensitive to the exact pixel alignment (I mean that this would not happen if we had for example 1 pixel per point in the X direction).
    Anyway, if you use Cursor Index instead (which is an integer) the behaviour is as expected.
    Paolo
    Paolo
    LV 7.0, 7.1, 8.0.1, 2011

  • ResultSet wihtin ResultSet but causes cursor problem?

    I have a SQL error when running the code below:
    while(rs0.next()){ ...
    String s= rs0.getString(1);
    ResultSet rs=null;
    rs=getResult1(aConnnection, s);
    /*statment is created in the function and ResultSet returned */
    while(rs.next()){ ...
    rs.close();
    rs0.close();
    Error: java.sql.SQLException: ORA-01000: maximum open cursors exceeded
    The database setting is 200 cursors
    and rs0 has 300 records, rs has only one record each time. I thought there should be only 2 cursors involved, do not know how can get so many.
    Could some one help with my question?
    Thanks in advance,
    YM

    Rethink your design.
    If you let a method create a statement and a resultset, but return only the resultset, then there's no possibility to close the statetement.
    I would create the statement outside the method, pass it to the method to do the query and return the resultset, but control the statement in my calling code.
    So in your example you would hold references to 2 stattement just the same way like to their resultsets and close them all together.
    This is more clean, and maybe will solve your cursor problem.
    If you should come to the result that you would really need more open cursors (if your app runs on many clients at the same time, it could), there must be a DBMS configuration for increasing this limit.

  • Strange flashing cursor problem

    Hi,
    I've just finished installing Vista 32bit on my Macbook Air (1.6) and its working fine apart from one small problem - when starting up it freezes on a black screen with a flashing cursor for 2-4 mins and then will start loading Vista fine. Once in there is no problem and its stable and what not. I have had a look at some on the articles on here and other forums and the flashing cursor problem usually refers to when people try to first install a MS OS and not once one has been installed successfully.
    I only have to boot into Vista every now and then and only for a few minutes at a time so I usually spend as much time in Vista as it does loading.
    Any help appreciated.

    General purpose Mac troubleshooting guide:
    Isolating issues in Mac OS X
    Creating a temporary user to isolate user-specific problems:
    Isolating an issue by using another user account
    Identifying resource hogs and other tips:
    Using Activity Monitor to read System Memory and determine how much RAM is being used
    Starting the computer in "safe mode":
    Mac OS X: What is Safe Boot, Safe Mode?
    To identify potential hardware problems:
    Apple Hardware Test
    General Mac maintenance:
    Tips to keep your Mac in top form
    Direct you to the proper forum for MacBook :
    MacBook Series Forums 
    https://discussions.apple.com/community/notebooks?view=discussions
    http://www.apple.com/support/macbookpro
    Mac OS X Forum
    https://discussions.apple.com/community/mac_os?view=discussions
    This forum deals with a desktop/tower 65lb Mac Pro
    http://www.apple.com/support/macpro
    TimeMachine 101
    https://support.apple.com/kb/HT1427
    http://www.apple.com/support/timemachine
    Mac OS X & Mountain Lion Community
    https://discussions.apple.com/community/mac_os
    https://discussions.apple.com/community/mac_os/os_x_mountain_lion?view=discussio ns
    Recovery Mode
    http://support.apple.com/kb/HT4718
    Unless you did a clean install, and I can't tell what your system maintenance is whether it is what I would do. Backup / clone your system, use ML RECOVERY and erase the system partition and update with just Apple updates, don't restore anything.
    Run Apple Hardware Test.
    Take it in for a free check and diagnosis.

  • Cs5 Brush cursor problem, on MacBook pro lion, tried the latest update, and the genious dude had no idea of what to do! Apple any fix?

    Cs5 Brush cursor problem, on MacBook pro, tried the latest update, and the genious dude had no idea of what to do! Apple any fix?

    Additional Info - after working on this problem for 4 hours, I shut my laptop in frustration and took a break.  1 hour later I opened my mac and the cursor had magically returned.  No restart, no power on/off - nothing.  Frustration.  If anyone else has had this happen and has actually fixed the problem let me know. I'm sure it will reoccur.

  • Brush Cursor Problem

    Hello, I've been experiencing a weird brush cursor issue and I haven't been able to find anything online to fix it. 
    This cursor problem is different from the "chunk of cursor missing upon resizing" issue that so many people have had.
    In Photoshop, when I resize my brush using the "[" and "]" keys, I will  often see my cursor get distorted. It will very briefly appear to the  right of where the cursor should be and it will look kind of oblong.  Another distortion that occurs is the cursor very briefly becomes a half  circle that is a bit larger than the cursor should be. This usually  happens between 150px and 250px size and occurs with all brushes.
    I'm also experiencing a distortion when I move the brush cursor over to  the panels section. This distortion appears (again, very briefly) as a  broken up horizontal line just above the brush cursor. Also, within this  line, I can see the regular pointer arrow cursor. Sometimes I see two  arrow cursors within the line and other times just one. This happens  with all brushes of size 500px or less.
    I have updated my video card drivers to the latest version and I have updated my Photoshop with the latest patch. 
    I use Photoshop CS5 64-bit, Windows 7 Home Premium 64-bit, and a Toshiba  Satellite L655-S5157 with an Intel(r) HD Graphics video card. 
    I heard about someone with a problem somewhat similar to mine and he  said he fixed it by manually deleting his preference files. He had tried  doing the shift+alt+ctrl on startup to delete his preference files, but  it didn't fix the bug (I tried it too and it didn't work for me  either). 
    I would like to try manually deleting my preference files, but I just don't know where they are. 
    Thanks for any help.

    For you (or anyone reading this thread), try to get a machine with an embedded ATI or nVidia display interface.
    Intel seems to be coming out pretty strong in the laptop market because they offer embedded GPUs in their chipsets, but Intel has a LONG way to go to get their OpenGL implementations up to par.  What I don't understand is that they've been known for having relatively poor OpenGL implementations for years now.  It's not like they're a small company who can't afford to fund a good development staff.
    To this day I'm still fighting Intel-specific problems seen by people running my own OpenGL software, where ATI and nVidia implementations are rock solid.  Stuff that's documented - such as handing off an OpenGL context between threads - just fails utterly with an Intel driver/GPU.
    -Noel

  • Cursor Problems in Adobe Edge

    Hi!
    I have this problem.
    I opened an Adobe Edge working file, run it and there are cursor problems in the latest Adobe Edge version. I was doing a drag and drop animation. Cursor problems did not exist in the older Adobe Edge version. I had to install the latest Adobe Edge Animate as the previous version had expired. This cursor problems of going hay wire after running it from the working file, has been going on for a few animations. And it takes more time and effort for me to rectify and debug the errors before continuing with my work. By the way, the .html from the previous Adobe Edge version works alright. It is only when I want to edit the working file in the newer Adobe Edge version, that it gives me all these problems.
    i hope someone will help me and thank you for your time.

    Hi OrionsEdge,
    I'm able to solve the problem. I looked through the codes and tried changing those parts which require the symbols' position to be changed through trial and error. If i'm not mistaken, it is related with the CSS.. it is tedious, but yeah, just change a part of the symbols' position first and try out the whole animation. observe and note down what are the changes. It will help you alot in your future code editings of the animations.

  • Vanishing cursor problem

    new imac 24' with a vanishing cursor problem, once or twice a day my cursor vanishes sometimes I can get it back by hitting the force quit shortcut keys at which point it will appear in the force quit dialog box, sometimes this does not work, at which point I have to reboot by holding down the power button, while in the force quit dialog box without the cursor visible i can use keyboard to quit all open apps and relaunch the Finder this has no effect.
    uplugging and replugging has no effect, plugging into a different port has no effect, using two different usb mice has no effect.
    I am using a logitech laser mouse that works perfectly on two other macs, the problem occurs with or without the logitech software running and also occured using the steermouse mouse driver.
    all software appears to be up to date using software update ect.
    cursor does not just become invisible, panning madly around with the mouse produces no effect in terms of opening the dock or whatever.
    Help please!

    Try posting in the MacBook Pro forum. We in the old G4 Tower forum are not familiar enough with the new systems to give out any advice!
    Cheers!
    DALE

  • 10.8.2 cursor problems

    I am having terrible cursor problems after I installed 10.8.2. After starting the computer, the cursor refuses to move or jumps around, often the screen will resize. I have run the Disc Utility but that does nothing.

    Yeah, I'm running OS X Server also on a Mac Mini and from my experiences, the PCs in the household couldn't connect via SMB to the Mac Mini until I set the Workgroup and Netbios Name in the WINS tab in Network on the Mini after a reboot.
    Did any hardware change? Like maybe the router was replaced with a different brand and the Konica isn't getting the correct IP address?

  • Libretto W100 cursor problems

    Hi,
    I have lots of cursor problems on a new Libretto W100. Using the cursos field on the display it move it in exactly the opposite direction on the top screen. So I go to the right-below, the cursor moves in left-up direction. The only way I found to stop this problem is a complete reboot. And then it works OK, but when I close the lid and leave it alone for for example two hours, come and activate it the problem reappears. I especially not even touching the screen(s) to avoid confusing the machine. But I can consistently reproduce it.
    Very annoying. Any one seen this and/or has a solution?
    Regards,
    Wim.

    I found that the screens work properly after updating the various software updates on the toshiba download site. It is not very clear on the site which ones are essential but I used the registry patch and the software suite upgrade and things are better. Only remaining problem I have is that the touch pad no longer works- anyone got a solution for that?

  • Missing Cursor problem in Pages still exists

    Beginning with page 97 of a document you cannot place the cursor at the bottom of the document anymore.
    There already is an archived discusion on it but I don't find any further hints whether it is now a bug accepted by Apple:
    https://discussions.apple.com/thread/2695065?start=0&tstart=0
    I can reproduce this problem with all my books written with pages and without any import from other software. And I hope to continue to write books with Pages so I desperately hope that this will be fixed soon.
    Is there any further hint available?
    Thanksalot

    Again, thank you for the quick answers. Of course there are several work arounds possible. As speed is crucial to me writing books and as I layout them including a lot graphics right from the beginning I would have to change my way of working just because of a bug. And, isn't it is a Mac and not a PC? The bug is older than 18 months - that is not very promising. From our development of the CONSIDEO MODELER we are used to fix any bugs within 3 months. What is promising, is that the documents can be edited with no problems on the iPad. However, as the iCloud for the exchange of iWorks documents between OS X and iOS is still a bad joke I am not satisfied. Maybe Apple can improve both, the iCloud functionality and Pages.
    Fingers crossed

  • Using if statement in cursor problem

    Hi, I am getting problem in cursor in plsql. i'e
        DECLARE
        CURSOR curRec IS
              if condition then
                   select query1;
              else
                   select query2;
              end if;
          c1rec curRec%ROWTYPE;
    Pls.. help.

    SQL Developer (Not for general SQL/PLSQL questions)
    Please mark this question as answered and post again in SQL and PL/SQL
    Regards
    Marcus

  • Open cursors problem- j2ee + oracle 10g

    Hi,
    I am using EJB on sunOne application server 8.1., Oracle 10g DB.
    EJB container connects to Oracle DB through a set of connection pools.
    BMP for all entity beans.
    I have about 160 PL/SQL functions that make up the business logic of the online application. everytime the application runs, I get an increasing number of open cursors, including some of the ones that are explicitly closed within PL/SQL (inspection with sys.v_$open_cursor).
    I made sure all CallableStatements, PreparedStatements, RecordSets within the beans are closed and set to NULL. All PL/SQL functions use explicit cursors, so every select statement is managed within a cursor which is explicitly closed when the function finishes with it.
    From v$open_cursor, I identified the sessions with the cursors still open, and issued (ALTER SYSTEM KILL SESSION �sid, #serial�) for each of the sessions (this is done via a PL/SQL function for all inactive sessions).
    These sessions have state INACTIVE, and wait_class IDLE. This has Killed all sessions, but I was not able to use the application anymore. I suspect by killing those sessions we have also caused the connections between EJB container and the Oracle DB. The only way to use the application now is to stop and restart the sunONE domain � this is very inconvenient.
    Has anyone encountered a similar problem? any suggestions to reduce or eliminate the open cursors number? Please help.
    Thank you all

    Maybe you can try to have a smaller steady-pool-size and idle-timeout-in-millis for your connection pools.
    Also, if that's at all possible, have smaller number of connection pools being shared by more apps.
    Just my 2c.
    thanks.

  • Amount of open cursor problem

    I am trying to display a tree-like data with a varchar2 field called ancestor indicating its family nodes, e.g. 1:2:5:16. A quick solution would be recurssion:
    procedure data_list(id in number default null) as
    cursor c1 is select * from table1 where ancestor is null;
    cursor c2 is select * from table2 where get_parent(ancestor) = id;
    -- get_parent(varchar2) is a function return parent id of current data.
    if (id is null) then
    -- display root nodes
    -- open c1 and print out data
    -- then recursively call itself to print out its children
    data_list(id);
    close c1;
    else
    -- open c2 and print out data
    -- then recursively call itself to print out its childen
    data_list(id);
    close c2;
    end if;
    end data_list;
    ======================
    As you notice, the problem is that if the tree is too high (or too deep) the amount of cursors being open simultanously might be huge, which will definitely degrade the performance of the server, especially under multiuser environment.
    Does someone here have better solution for this problem?
    Thanks.

    You probably want to start by looking into Oracle's hierarchal query support with the CONNECT BY clause and the SYS_CONNECT_BY_PATH function. Grabbing a quick example from the Oracle SQL Reference http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/functions121a.htm#1038139
    SELECT LPAD(' ', 2*level-1)||SYS_CONNECT_BY_PATH(last_name, '/') "Path"
       FROM employees
       START WITH last_name = 'Kochhar'
       CONNECT BY PRIOR employee_id = manager_id;
    Path
    /Kochhar
       /Kochhar/Greenberg
         /Kochhar/Greenberg/Faviet
         /Kochhar/Greenberg/Chen
         /Kochhar/Greenberg/Sciarra
         /Kochhar/Greenberg/Urman
         /Kochhar/Greenberg/Popp
       /Kochhar/Whalen
       /Kochhar/Mavris
       /Kochhar/Baer
       /Kochhar/Higgins
         /Kochhar/Higgins/GietzNote that hierarchal queries work very well when you have tree data. If you actually have a graph, it starts to get more complicated.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Cursor problem in dark background

    Hi, I've changed my terminal bg to black, but i have problem to see text cursor espesialy when display brighness is low, i have to really try to find it when i want select text

    Ok here is an example of a script that doesn't work:
    drop type numset_t;
    drop type num_type2;
    create or replace type num_type2 as object (x number(4), y number(4));
    create or replace type numset_t as table of num_type2;
    create or replace function f1(x number) return numset_t pipelined is
    out number;
    cursor myCursor is select * from cat;
    begin
    for i in 1..x loop
    pipe row(i);
    end loop;
    return;
    end;
    show errors;
    It gives me that output in sqlplus:
    SQL> @test
    Type dropped.
    Type dropped.
    Type created.
    Type created.
    Warning: Function created with compilation errors.
    Errors for FUNCTION F1:
    LINE/COL ERROR
    6/7 PL/SQL: Statement ignored
    6/16 PLS-00382: expression is of wrong type
    And here is what I get when I do:
    SQL> select * from cat;
    TABLE_NAME TABLE_TYPE
    TAXONTMP TABLE
    TMP_CMBSEQID2UPI TABLE
    Any idea?
    Thanks,
    Mathieu

  • Hardware Color Cursor Problem in Windows 8.1

    I have 2 issues related to the cursor on Win8.1 with 2 display adapters.  It seems Windows 8.x problem.
    Issue #1, Primary display adapter is using hardware color cursor and secondary adapter is software cursor. It will have cursor left over on the secondary screen when the cursor is moving from
    secondary screen to primary screen.
    Issue #2, Primary display adapter is using hardware color cursor and secondary adapter is software cursor. There will be 2 cursors on the left upper corner of the primary display screen when
    dragging the cursor around the upper left corner of the primary display screen.
    So the problem seems caused by 2nd display adapter doesn't support hardware color cursor then will create these two problems.  
    If I switched to software cursor in the Control panel, then there will not have these problems. Also if both use hardware cursor, then there is no problem.  
    Can anyone help to confirm if this is the Windows 8.x bug or not?
    Thank you very much.
    Regards,
    Francis

    Hi Francis Fung,
    When checking in Mouse Properties, I couldn't find any settings that would allow me to change to software cursor under any tabs like Buttons, Pointers, Pointer Options, Wheel and Hardware(reference)
    Some specific mouse would have its own functions, make sure that we follow the instructions to configure the settings, for the two adapter issue, please also consider seek help at the manufacturer side and see if any further help would be offerred there.
    Thank you for your understanding.
    Best regards
    Michael Shao
    TechNet Community Support

Maybe you are looking for