Using the cursor to insert a value

Hello
I created a procedure mentioned below, using the slider that I want to insert a value in the table its not to insert any value. You can one to find the solution. I have compiled the procedure there is no errors...

I have a lot of value in the employee... then after table do not perform the procedures no value in employee_lkp


My structure from the Employee table is

CREATE TABLE 'VIDHYA '. "' EMPLOYEE '.
(
VARCHAR2 (15 BYTE) "PNOM."
'MINIT' VARCHAR2 (2 BYTE),
VARCHAR2 (15 BYTE) "LNAME",.
ACTIVATE THE "SSN" NUMBER (12.0) NOT NULL,
"BDATE" DATE,
'ADDRESS' VARCHAR2 (35 BYTE),
'SEX' VARCHAR2 (1 BYTE),
ACTIVATE THE "WAGES" NUMBER (7,0) NOT NULL,
NUMBER (12.0) "SUPERSSN."
ACTIVATE THE 'DNO' NUMBER (2.0) NOT NULL,
ACTIVATE THE STATISTICS STORAGE CALCULATION (INITIAL 65536 THEN 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 USER_TABLES DEFAULT TABLESPACE) 'USERS' CONSTRAINT 'PK_EMPLOYEE' KEY PRIMARY ("SSN") WITH THE HELP OF INDEX PCTFREE 10 INITRANS MAXTRANS 255 2.
CONSTRAINT 'FK_DEPARTMENT' FOREIGN KEY ('DNO') REFERENCES 'VIDHYA '. "" DEPARTMENT "("DNUMBER") ALLOW
)


employee_lkp structure is

CREATE TABLE 'VIDHYA '. "" EMPLOYEE_LKP ".
(
VARCHAR2 (250 BYTE) "PNOM."
VARCHAR2 (250 BYTE) "LNAME",.
'ID '.
)


create or replace
procedure employeelkp is
number of add_val;
i the number;
number num.
add_name cursor is select * from employee;
name_cur add_name % rowtype;
Start
Open add_name;
Select count (*) in the number of the employee;
because me in 1.num
loop
extract the add_name in name_cur;
insert into employee_lkp (id, fname, lname)
values (i,
name_cur. Lname,
name_cur.fname);
When the output add_name % notfound;
end loop;
close add_name;
end employeelkp;

Try this...
Add

commit;

After

close add_name;

at the bottom.

I hope this helps...

Hamid

Tags: Oracle Development

Similar Questions

  • Why we use the cursor

    Hi all

    I would be grateful someone right me if I'm wrong. I ask the question below just for my purpose of learning.

    Question - Why do we use the cursor?

    Response Cursor is used to treat several lines in PL/SQL.

    Or

    Is used to treat a set of records from one or more tables, you can write a cursor on the table using select statement and then you can browse through all these a Recordset, and perform your required operations.

    Post edited by: Muzz, I'll open another discussion to my other question. Thank you

    Hello

    Muzz says:

    Hi all

    I would be grateful someone right me if I'm wrong. I ask the question below just for my purpose of learning.

    Question - When we use Procedure and Function when?

    Response

    When you want to run a series of DML statements then do like us and when we want to return a single value, then we use the function.

    Much has been written on this subject.  Start by finding some of them:

    https://www.Google.com/#q=when+use+procedure+function+Oracle

    read some of them and then ask a more specific question

    Procedures are not just for the DML; There are a lot of things in addition to DML you can do in the procedures.  For example, you can send e-mail messages, or can read and write files.

    The second half of your response, 'when we want to return a single value, then we use the function', is the right of bascally.  In particular, when you want to return a value that will be used in a SQL statement, you use a function.

    Functions in the pipeline are a special case.  A lot of what you read or you say about 'functions' means implicitly 'no Pipeline functions.

    Question - Why do we use the cursor?

    Response Cursor is used to treat several lines in PL/SQL.

    Or

    Is used to treat a set of records from one or more tables, you can write a cursor on the table using select statement and then you can browse through all these a Recordset, and perform your required operations.

    You'll have best results if you start a separate thread for each separate issue.  This issue is completely separate from the question on procedures

    You're right that the sliders are a way to process the rowsets, which can contain 1 line or several lines.

    Yes, you can use a slider to manage the rows one at a time.  Do not forget that it will be less effective than the manipulation of all at once, so don't use a cursor to do something that can be done in a single SQL statement.

  • The function does not properly when you use the shortcut to insert

    Hello everyone. I am using first Pro CC V9.2 on a PC.  I am as well as a Lynda tutorial and told me quite clearly that using the comma key insert a subclip in my sequence.  However, using the shortcut brings in the full clip, not the sub.  I just bring my subclip using a drag and drop, which is really slow me down.  Anyone know what this could be?

    When you perform your subelements, you Restrict toppings to the limits of a verified subitem?

    MtD

  • When to use the cursor for loop and the cursor (open, fetch, close)

    Hello world
    I have a small doubt about when to use the cursor for loop and when to use the cursor for loop and the cursor (open, fetch, close).
    Well, I'm not the difference between implicit and explicit cursor. So please tell me how I got to know, what to use and when?




    Kind regards
    BS2012

    Published by: BS2012 on January 29, 2013 12:15

    All SQLs are analyzed, stored and executed as cursors. Thus, you will always use a cursor.

    The problem is that languages, such as PL/SQL, provide different interfaces to interact with the SQL cursor. As the ref, the slider interface, the interface DBMS_SQL slider interface and so on.

    Each of these interfaces offers different features. For example, using the interface DBMS_SQL allows binding dynamics and dynamic recovery. The Ref Cursor interface allows your code PL/SQL pass a handle to a reference pointing to the SQL cursor, to an external client. Etc.

    The fundamental reason for the use of an explicit cursor interface is mainly that you own and manage bulk made extraction output provided by PL/SQL cursor.

    With a cursor FOR , the motor loop of PL/SQL optimize the loop by extracting block a 100 lines both. However, you cannot access this collection in bulk directly inside the loop.

    With an explicit cursor interface, you specify the size of the extraction in bulk via the clause LIMIT , and you set the variable of collection to use. This allows you to use the collection directly variable inside the loop.

    However, the need to do - code manually in bulk collection - rarely occur in the daily programs in PL/SQL. A line of treatment is both slow and not well fits. And even if your bulk code collects lines, these lines must still be processed one at a time in your code. It is much more efficient and scalable rather write SQL code, and make the engine SQL the line of treatment for you.

  • How to use the Type of Oracle Table values in the Select statement.

    Hello

    I get the initial set of values in the Table of Type Records of the Oracle and want to use the list of values in the Select statement.

    For example, try something like the following:

    TYPE t_record () IS RENDERING
    ID TABLEA.ID%type,
    NO TABLEA.NO%type

    );
    v_record t_record;
    T_table TYPE IS the v_record TABLE % TYPE;
    v_table t_table;

    -Code to fill the values of v_table here.

    SELECT ID, NO, COLLECT in BULK IN < some other table variabes here > FROM TABLEA
    WHERE ID IN (i) v_table USER.USER;

    I want to know how to use the Type of Oracle Table values in the Select statement.

    Something like this:

    create or replace type t_record as  object (
    id number,
    no number
    )
    /
    
    CREATE or replace type t_table AS TABLE OF t_record;
    /
    
    set serveroutput on
    declare
    
      v_table t_table := t_table();
      v_t1 t_table := t_table();
    
    begin
    
      v_table.extend(1);
      v_table(1).ID := 1;
      v_table(1).No := 10;
    
      v_table.extend(1);
      v_table(2).ID := 2;
      v_table(2).ID := 20;
    
      SELEC t_record (ID,NO) BULK COLLECT INTO v_t1
      from TableA
      FROM TABLEA
      WHERE ID IN (select t.ID from table(v_Table) t);
    
      for i in 1..v_t1.count loop
        dbms_output.put_line(v_t1(i).ID);
        dbms_output.put_line(v_t1(i).No);
      end loop;
    end;
    /
    

    No test!

    P;

    Published by: bluefrog on March 5, 2010 17:08

  • How to choose the maximum value in a column of a table by using the cursor and iteration

    Hello everyone
    I have a table loan_detail
    and a column inside loan_amount
    now I want to take the values in this table with the cursor, then using iteration that I want to take a max value of him using this slider
    Here is my table
    LOAN_AMOUNT
    
    100
    200
    300
    400
    500
    5600
    700
    I could make using the concepts of single loop, but when I tried to do by using the slider I wasn't able to do.
    Concerning
    Prost

    You can get the maximum value for a particular column in SQL, PLSQL needn't; Always avoid PLSQL so you can do it in SQL. But always as an example:

    declare
    number of Temp: = 0;
    Start
    for news in some loan_amt of loan_detail
    loop
    If (temp
    end if;
    end loop;
    dbms_output.put_line (temp);
    end;

    Edited by: Mahanam January 5, 2011 03:11

  • Point display XY graph using the cursor data

    Hello all, I use XY graph to display amplitude v/s time. During the vi execution, data are continuously plooted on chart until the user stops the vi. I want to add a feature, such that, during the execution of the vi, when the user clicks on the chart to the situation with the cursor, it should show corresponding value of time and amplitude of this point. I mean the value of the axis corresponding to the category axis not the cursor position. When you use the position of the cursor, it is ok with the x axis, but it shows the cursor position for y axis (as property said), and I want datavalue said not not the position y axis.

    I hope it's clear with the question. I would like to have a few examples... for y = x graphic below, you can see cursor x = 4.4 and y = 6.8, how to view corresponding datapoint which must be y = 4.4

    When creating (or even after you've created), choose "align on the" plot 0.

    Do not let it be 'slide free.

    Attached example.

  • HP laptop, 2000 - 2a20CA: Page of the screen shrinks by using the cursor key

    Laptop HP 2000-2a20CA

    No. B5R61UA

    It seems the upgrade from Win 7 to win 10 Home edition, in navigation or by using a Microsoft Office program, the windows Explorer.

    When you move the cursor with the touchpad and then listen to select a link, function etc. anywhere on the screen/page.

    The screen will decrease in size to the left or right of the screen or reduce to the taskbar.

    Clues, there is problem Win 10 or touchpad.

    HP 2000-2a20CA, running Windows 10 laptop

    Thank you

    I think I solved the problem because now I think.

    To check the HP site looking for updates to Win 10 and none were found.

    But then I changed my version of Windows to win 8 then rechecked updates and there is an update for the touchpad dated March 2016.

    Downloaded and installed, and everything seems OK so far.

    Thanks again.

  • using the button to select distinct values

    I would like to have a button where a user can choose one of four options: 6, 12, 18, 24.  I updated the properties of force and I changed the labels so that it looks only four options are available but it always allows me to choose between 6 to 24 in 1 increments.  I used an indicator to see what data are produced by the control and it shows also from 6 to 24 with increments of 1.  Am just using the wrong control?

    You can use text labels. Right click on the Select button. Right click again and create the visible text display. You can then right-click on the display of text labels and select "edit items". Add as many items as you want and to assign a digital specific to each label, uncheck the box for sequential values.

  • JavaScript to set radio button choices using the drop-down list box value.

    I use Adobe Acrobat Pro DC version 2015.016.20039 on a MacBook Pro OS X El Capitan version 10.11.6.

    I have a set of named CitBox radio box choices. I'm defining what choice is selected from out of a drop-down list named AppCitizenship box.  Both of them have six choices with values of 1, 2, etc. (I thought having the same values would make easier the translation from one to the other). Thanks in advance.

    If you used the same values, then it is pretty easy. Just use this code as the validation script custom field drop-down list:

    this.getField("CitBox").value = event.value;

  • need to use the cursor for the query

    Hi all
    can someone tell me how to get the result of the following query using the slider?

    SELECT (SUBSTR('        ', 1,LEVEL*2)
      || t1.label) AS t1_label,
      amount
    FROM
      (SELECT t1.label,
        t1.ID,
        t1.parent_id,
        SUM(t2.turnover) AS amount
      FROM t1,
        t2
      WHERE t2.t1_id = t1.id
      AND t2.t1_id  IN
        (SELECT id
        FROM t1
          START WITH t1.ID       = 2
          CONNECT BY PRIOR t1.ID = t1.parent_id
        )
      GROUP BY t1.label, t1.ID, t1.parent_id
      ) t1
      START WITH t1.ID       = 2
      CONNECT BY PRIOR t1.ID = t1.parent_id;
    .. .and the result:
    t1_label             amount
    ---------------------------------------------------------
         B11     11778.54
          B121     19980.28
            B1211     18842.77
            B1212     25480.56
          B122     18339.07
        B12            23455.9
        B13            20876.52
    Thank you
    Alex

    Published by: 860003 on June 9, 2011 01:30

    Published by: 860003 on June 9, 2011 01:31

    Published by: 860003 on June 9, 2011 01:31

    decalare
    V_T1_lable varachar2 (250);
    Number V_AMT;
    cursor c1 is SELECT (SUBSTR (' ', 1, LEVEL * 2))
    || T1. Label) AS t1_label,
    amount
    Of
    (SELECT t1.label,
    T1.ID,
    T1.parent_id,
    Amount of Sum (T2.turnover) AS
    FROM t1
    T2
    WHERE t2.t1_id = t1.id
    AND IN t2.t1_id
    (SELECT id
    FROM t1
    START WITH t1.ID = 2
    CONNECT BY PRIOR t1.ID = t1.parent_id
    )
    GROUP BY t1.label, t1.ID, t1.parent_id
    ) t1
    START WITH t1.ID = 2
    CONNECT BY PRIOR t1.ID = t1.parent_id;

    Start
    Open c1;
    loop
    Fetch c1 into V_T1_lable, V_AMT;
    dbms_output.put_line(V_T1_lable||) e ---'|| V_AMT);
    When Exit C1% notfound

    end loop;
    exception
    When people then
    dbms_output.put_line(SQLCODE||) e --'|| SQLERRM);
    end;

  • Using the cursor to another (nested cursors) cursor objects...?

    Now, I'm pretty sure that's not possible, but as a last thought of the station, it would not hurt to ask.

    I have a number of fairly complex cursors in PL/SQL (all beautifully packaged upwards), which are used in a number of other different queries for reporting. Because the same cursor is reused several times in different contexts, I want set the cursor once, then use it as a subquery in the other queries. This will also help as if I place the SQL directly in other queries, then it will be necessary propagate the changes to the base query in all other queries which use - and that it will be maintained by a large team that goes forward, it would be wide open to things being missed... (not that I don't trust my colleagues or anything like that...!)

    So, in brief and simple terms, if I;

    CURSOR curDateList (pi_start_date AS, pi_end_date IN DATE)
    IS
    SELECT pi_start_date + rownum - 1 when
    FROM (select '1' sys.dual connects by level < = (pi_end_date - pi_start_date + 1));

    that returns a list of the dates of pi_start_date to pi_end_date, and I want to integrate in another slider like;

    CURSOR curEmpWork (pi_start_date AS, pi_end_date IN DATE)
    IS
    SELECT e.employee_id, dl.when, e.work_pattern
    OF e xxx.emp_work_patterns,.
    DL curDateList (pi_start_date, pi_end_date)
    WHERE dl.when = e.roster_date
    ORDER BY e.roster_date;

    (Needless to say that queries are much more complex and many!)

    I reached the required result by using the pipeline table functions that just open the first cursor and run each line, but am frequently end up using multiple nested functions to achieve and I see marked in this way, then the performance degradation that comes to nest queries within the other runs a lot faster. As a nested query is just a nested cursor, it seems that this is possible, but I'm not only have no chance - I am struggling to find something that says that it of possible or not (which made me think I am barking the wrong tree here!)

    Any help would be greatly appreciated.

    No, it is not possible, but have you thought of creating a view instead?

  • Problems to use the cursor to select the format of pdf text precisely

    When you try to select a bit of text that is in a text (as opposed to a text box) on a form object, the cursor highlights several other items of text on the page.

    I'll try to reproduce it below:

    It is just the nature of the documents in pdf format, or is this something that can be avoided.

    I made sure to give each its own name text object, but the problem persists.

    Let's say that I tried to highlight all the end of this sentence.

    Note that the other texts are selected as well.  This would happen in a form when I would try to select only the text: "the end of this sentence."

    Its not impossible to select the text I want in acrobat, but it seems to be very sensitive on the forms. Just to have the cursor slightly outside the central axis of the text, and half of the shape is selected.

    Is it possible to make it more like the text in a text field?

    Thank you!

    Nope!

    It's just the way it is.

    Niall

  • Cycling pictures using the cursor.

    Hi, I am a complete newbie to flash (it took me 10 minutes just to find out where to put actionscript code lol). In any case, I'm doing a flash where you can scroll through the images using a scroll bar. These are images of a face of people of 13 angles from 90 degrees to the left, looking at the Center, right 90 degrees. I want to be able to turn the face using the slider. What I'm trying to do is similar to another thread, I read (but not exactly the same goal) so I took the code from there just to started get me. Currently when I test the movie face moves backward (looping) and the scroll bar does not interact with the images/images. This is the code that I have 1 image 1 layer. I know that this code can be completely wrong for what I wanted to do since I pulled it of someone elses project.

    function f (mc:MovieClip, x 1: number, y1:Number, x 2: Number, y2:Number) {}

    MC.m =(Y1-Y2) /(x1-x2);

    MC.b = Y1 - mc.m * x 1;

    }

    f(mc_slider.mc_handle,mc_slider.mc_rail._x,1,mc_slider.mc_rail._x+mc_slider.mc_rail._width-mc_slider.mc_handle._width,mc_frame000._totalframes);

    {mc_slider.mc_handle.onPress = Function ()}

    this.startDrag (width of false, mc_slider.mc_rail._x, this._y, mc_slider.mc_rail._x + mc_slider.mc_rail. _ - mc_slider.mc_handle._width, this._y);

    clearInterval (current);

    Current = setInterval(dragF,50);

    }

    {mc_slider.mc_handle.onRelease = mc_slider.mc_handle.onReleaseOutside = Function ()}

    this.stopDrag ();

    clearInterval (current);

    }

    function dragF() {}

    frameNum = Math.round(mc_slider.mc_handle.m*mc_slider.mc_handle._x+mc_slider.mc_handle.b)

    trace (mc_frame000 + "" + mc_slider.mc_handle.m + "" + mc_slider.mc_handle.b +"" + frameNum)

    mc_frame000.gotoAndStop (frameNum);

    }

    And this is the code that I put in the symbol for the slider-

    This.PERC = 0;

    {handle.onPress = function ()}

    this.startDrag(true,0,0,rail._width,0);

    {this.onEnterFrame = function ()}

    perc=Math.round(this._x*100/rail._width);

    }

    }

    handle.onRelease = stopDrag;

    handle.onReleaseOutside = stopDrag;

    Any help would be appreciated, thanks!

    Thus, faces is not set on the timeline that contains this code (at the time where the trace() function).

    Click on an empty part of the scene (or behind the scenes) and then click on your movieclip of faces on stage.  in the properties panel, on the left side, type 'faces' without the quotes.

  • How ins or upd multiple values in a record of diff of the fields by using the cursor

    Hai All

    I need to insert or update or multiple values in a single diff of one field records to another table.

    Table 1 has 3 fields

    Bartime bardate barcode

    02/01/10 0011, 0815

    02/01/10 0022, 0820

    02/01/10 0011, 1130

    02/01/10 0022, 1145

    02/01/10 0011, 1230

    02/01/10 0022, 1235

    02/01/10 0011, 1645

    02/01/10 0022, 1650


    These are the times that arrives at 0815 and pauses at 1130 and arrives at 12: 30 a.m. and coming home at 4:45 pm
    These table I have to insert into another table called table2
    and the fields are bar codes, date, intrinsically timein, introut, tiomout

    And the output you want to like this

    barcode timein intrinsically introut timeout date
    0011 0815 1130 1230 1645 02/01/10

    0022 0820 1145 1235 1650 02/01/10

    If all give some good answer that it will be help full...

    Thanks and greetings

    Srikkanth.M

    Hi Srikanth,

    1. first create a datablock (better do instead of the table because its only for querying details of table 1 for the period) with table1 as table base and better use order by clause in form as "order to barcode, date, bartime.

    2. create a second datablock with table2 and get this rank on the two table (second block as base table, because here, you should insert/update)

    now on the screen you can see all the data in 2 tables.

    3. fix the button of some process.

    a time-but-press

    Loop

    1 block of travel and take a line

    Find the same block 2

    If code in bars-avail so
    -you want to update
    on the other
    -you want to insert

    end if;

    end of loop

    and 2nd block will be updated / inserted as u desire, and finally, you can save the second block.

    Iqbal

Maybe you are looking for