Forms :: Update Particular Employee Name By Using Cursor

Jul 14, 2013

I would like to update the particular employee name by using the cursor ..For that I would like to show the steps which I did . as in the below screen it updated John but it removed the other ename ...I like to update John only and remaining ename should be as it ..

The code which I have written on KEY-COMMIT is below.

View 1 Replies


ADVERTISEMENT

Forms :: Update Table With Cursor

Oct 5, 2010

I have made changes in my form

1st step:-

for Inserting records created below cursor, records are inserted and I can see on my screen (form) also.

DECLARE
CURSOR InvestIS
select * from Tempinvest;
BEGIN
OPEN Invest;
GO_BLOCK('ReturnReport');
last_record;
[code]......

2nd step:-

Updating records
I wan to update some columns in this table so I created a 2nd cursor to update records but this cursor is not working accordingly. my requirement is: before Update first of all Find inv_co_code & inv_fnd_code when find then update column Redunits

2nd Cursor

DECLARE
ddate date; refdate date; co_code number; co_name varchar2(50); fnd_code number; fnd_name varchar2(50); units number; amount number; stat varchar2(1);
CURSOR bnr IS

select Ddate,refdate,co_code,co_name,fnd_code,fnd_name,units,amount,stat from (
select inv_date DDate,Vdate RefDate,inv_co_code Co_code,inv_co_name Co_name,inv_fnd_code Fnd_code,inv_fnd_name Fnd_name,
inv_nofu Units,inv_amount Amount,Status Stat from (
------------- Bonus -------------------
select inv_date,vdate,inv_co_code,inv_co_name,inv_fnd_code,inv_fnd_name,inv_nofu,Inv_amount,inv_uprice,'B' Status from investment
where code is null and inv_date <= :dd1
---------------- Redemption --------------
Union All
select red_date,null,red_co_code,red_co_name,red_fnd_code,red_fnd_name,red_nofu,red_amount,red_uprice,'R' Status from redemption
where red_date <= :dd1
))
where co_code = 13 and fnd_code = 1
order by co_code,fnd_code,ddate ;
------------------------------------------
vddateddate%type;
vrefdate refdate%type;
vco_codeco_code%type;
vco_nameco_name%type;
[code].......

View 11 Replies View Related

SQL & PL/SQL :: Update Of Employee Table

May 28, 2011

I have to implement a functionality in my application. I have an employee table and each employee does a transaction which is stored in a transaction table.

The functionality that I have to implement is that if an employee does not perform any transaction for a period of 2 years then updated the employee and set him inactive.

View 3 Replies View Related

SQL & PL/SQL :: Update In Employee Table?

Apr 4, 2010

Employee Table
==============
create table empoyee (
empno number,
sal number)
insert into employee(empno,sal) values (1, 200);

[code]...

If we make any update in Employee table for his/her salary, before update, that record should be inserted into EmployeeHist table and history will continue to build. Employee Table should have only current salary.If we change sal for emplyee # 1 from 200 to 800 then original current record in employee table will be inserted into employeehist table like

empsno = 1
empno =1
sal=200
last_update=sysdate

View 10 Replies View Related

Update Statement Versus Cursor Based Update

Sep 7, 2010

I have to update 20 and 60 million records of a table. The update statement are

1> 20 million recs
update mycustomer set update_time=add_months(sysdate,240) where seq_num = 1;

commit;

2> 60 million recs
update mycustomer set update_time=sysdate-seq_num where seq_num <> 1;

commit;

Q1> Is there any way to improve performance
Q2> Will parallel dml improve performance
Q2> Would a pl/sql cursor make any difference in speed.

View 1 Replies View Related

SQL & PL/SQL :: Print Ename And Salary Of Employee Using Employee Number As Input

Aug 11, 2013

/* Formatted on 2013/08/11 18:46 (Formatter Plus v4.8.8) */
CREATE PROCEDURE p_get_name (
p_empno IN OUT NUMBER,
p_name OUT VARCHAR2,
p_err OUT NUMBER
[code].......

Note:- I want to print ename and salary of emp using empno as a input but i dont want to declare extra variable for salary , i want to print salary using empno but when i execute this procedure. It gives value of empno in salary. Don't Know Why , how can i print salary of emp using empno as input without declaring extra variable for salary.

View 25 Replies View Related

SQL & PL/SQL :: Employee Table To Assign Grade For Each Employee Based On His Salary

Feb 9, 2012

based on the following information

grade lowsal highsal
------ ----- ------
1 700 1200
2 1201 1400
3 1401 2000
4 2001 3000
5 3001 9999

for the employee table to assign grade for each employee based on his salary the following plsql procedure is giving error:

-----------------------------------------------------------
CREATE OR REPLACE PROCEDURE GRADE(EID IN NUMBER,BONUS OUT NUMBER) IS

vGRADE NUMBER(8,2);
vSAL NUMBER(8,2);

BEGIN
vGRADE=1
SELECT SAL INTO vSAL FROM EMP WHERE EMPNO=EMPID;
IF vSAL<= 700 THEN
vGRADE:=1;
ELSEIF vSAL<= 1201 THEN
[code]....

View 4 Replies View Related

Forms :: Populate Only Particular Employee LOV

Apr 1, 2013

I want to populate only particular employee LOV ,when i am press "Populate LOV"..Button and i attached Form for testing and It is a 10g version..

View 5 Replies View Related

SQL & PL/SQL :: Using For Update In Cursor

Feb 18, 2010

I have come across a code where i need to know exact logic for the use of FOR UPDATE and COMMIT used in a cursor.The code is like :

Declare
Cursor c1 is select * from emp FOR UPDATE;
Z c1%rowtype;
Begin
Open C1;
Fetch c1 into Z;
dbms_output.put_line(z.ename);
Commit;
Fetch c1 into Z;
dbms_output.put_line(z.ename);
end;

When i run above code, i get error as below, but first value from table emp i.e. emp.ename is displayed :

Error at line 1
ORA-01002: fetch out of sequence
ORA-06512: at line 9

But when i run by removing FOR UPDATE, i get first 2 values displayed without any error message:

Declare
Cursor c1 is select * from emp;
Z c1%rowtype;
Begin
Open C1;
Fetch c1 into Z;
dbms_output.put_line(z.ename);
Commit;
Fetch c1 into Z;
dbms_output.put_line(z.ename);
end;

View 2 Replies View Related

Forms :: Display Employee Details?

Feb 25, 2013

i want to display employees details when i am passing Deptno and that department employees only display in Oracle Forms

View 16 Replies View Related

Forms :: Create A Report For Absent Employee?

Oct 18, 2012

I have a requirement that I need to create a report for absent employee, we have "Hand Punch" scanning system for attendance, when a employee scan his hand it put a record with the employee id, date, shift, & time.

Now I need to create a report for absent employees in date range

View 2 Replies View Related

Forms :: Sending Employee PayRoll Slip

Jan 21, 2012

I am looking to send all employees in the company their payroll slip directly to their email IDs, so I need to built a producer can :

1- Generate their slips and save it into PDF files with each employee number .
2- send an email message to each employee with his slip.

View 2 Replies View Related

SQL & PL/SQL :: Using Cursor To Update Multiple Columns

Oct 22, 2011

I need to write a script which copies 4 col data from one table to another table. there are three tables

cwat_curr_mst and cwat_assigned_customer and cwat_assignment_mst.
Cwat curr mst has PK curr_id and cwat_assigned_customer has PK assignment_id.
Also cwat_assigned_customer has customer_id.
In cwat_assignment_mst has Curr_id and Assignment_ID.

cwat_curr_mst and cwat_assigned_customer tables has 4 cols in common
they are
ASRT_SNM_NO, SNM_NO, FLORIDA_NO, CBRN_NO.

So from curr_mst all these 4 cols data needs to come/copy into cwat_assigned_customer.

View 20 Replies View Related

SQL & PL/SQL :: Update Cursor - Fetch Out Of Sequence

Sep 17, 2013

I'm currently facing a non-critical situacion while trying to update a table. Here's the PL/SQL Code. It's a pretty straight-forward script, It just update one single column of the table. The only problem is that I have to update over 15 milions records. When I use the for update cursor, I put inside the loop a counter, when it reaches 1000 records, then commit, else keep counting.

The block throws the exception ORA-01002: fetch out of sequence.

I've tried to do some reserch on Google, buy it only says it is an out of secuence fetch caused by a commit inside a for update cursor.

My question is. Is there any risk by putting the commit under the end loop, I mean by doing this I'd be updating over 15.000.000 records at the same time. Will I have any issue with the rollback segment ?

Here's the code as along with the Create Table and Insert statements.

CREATE TABLE TEST_1
(
TEST_ID NUMBER PRIMARY KEY,
IS_LOCKED NUMBER NOT NULL
);

INSERT INTO TEST_1
(TEST_ID, IS_LOCKED)
VALUES
(1, 0);

[Code]....

View 12 Replies View Related

Forms :: Show Manager / Employee And Department On The Tree

Nov 1, 2012

i have 3 tables

table employee
employee_no
employee_name

table manager
manager_id
manager_name

table department
dept_id
dept_name

how can show on the tree all manager with employee with department

example
manager ali
employee Mohamed
department marketing

View 6 Replies View Related

Reports & Discoverer :: Link Two Forms And Pass Employee Name To Next Form

Jul 31, 2010

if i have two reports one of them is that you enter the office name and it will show you list of employee. the second one i want to show the information that is related to that employee by putting beside each employee button that if pressed i will go to other report that show me information about that employee.How i could link the two form and pass the employee name to the next form

View 4 Replies View Related

SQL & PL/SQL :: How To Retrieve Each Employee Age From Employee DB

Nov 25, 2011

I have a table like below,I want retrieve each employee age ,from db column

SQL> select * from dob;

ENAME DB
---------- ---------
vishal 12-MAR-90
jeya 30-MAR-73
vasanthi 17-APR-80
mangai 25-NOV-81
poorna 18-AUG-80
vinod 20-AUG-81
nanthini 01-JUN-86
karthick 20-MAR-88

View 4 Replies View Related

SQL & PL/SQL :: Cursor Select For Update / Multiple Columns Of Different Tables

Apr 8, 2010

i have two tables test1 and test2. i want to update the column(DEPT_DSCR) of both the tables TEST1 and TEST2 using select for update and current of...using cursor.

I have a code written as follows :

DECLARE
v_mydept1 TEST1.DEPT_CD%TYPE;
v_mydept2 TEST2.DEPT_CD%TYPE;
CURSOR C1 IS SELECT TEST1.DEPT_CD,TEST2.DEPT_CD FROM TEST1,TEST2 WHERE TEST1.DEPT_CD = TEST2.DEPT_CD AND TEST1.DEPT_CD = 'AA' FOR UPDATE OF TEST1.DEPT_DSCR,TEST2.DEPT_DSCR;
[code].......

The above code when run says that it runs successfully. But it does not updates the desired columns[DEPT_DSCR].

It only works when we want to update single or multiple columns of same table...i.e. by providing these columns after "FOR UPDATE OF"
I am not sure what is the exact problem when we want to update multiple columns of different tables.

View 5 Replies View Related

SQL & PL/SQL :: Dynamic Update Of Cursor Records When Table Gets Updated Immediately

Apr 16, 2010

I am having a table with 4 columns as mentioned below

For a particular prod the value greater less than 5 should be rounded to 5 and value greater than 5 should be rounded to 10. And the rounded quantity should be adjusted with in a product starting with order by of rank with in a prod else leave it

Table1

Col1prodvalue1rank
1A21
2A62
3A53
4B61
5B32
6B73
7C41
8C22
9C13
10C74

Output

Col1prodvalue1rank
1A51
2A52
3A33
4B101
5B02
6B63
7C51
8C52
9C03
10C44

I have taken all the records in to a cursor. Once after rounding the request of 1st rank and adjusting the values of next rank is done. Trying to round the value for 2nd rank as done for 1st rank. Its not taking the recently updated value(i,e adjusted value in rounding of 1st rank).

This is because of using a cursor having a value which is of old value. Is there any way to handle such scenario's where cursor records gets dynamically updated when a table record is updated.

View 9 Replies View Related

Forms :: Insert And Update Directly Into Table From Pre Update Trigger Of Block?

May 14, 2010

I have a base table (Table A) block with multiple records displayed. I need to track audits to this underlying table in the following way:

If user updates a field in the block I want the pre-changed record's audit fields to be set and I need to create a copy of the record with the changed values. Basically any changes will result in the record being logically deleted, and a copy record created with the newly changed values.

Tried to implement in the block's pre-update trigger which will call a package to directly update Table A then Insert into Table A, then requery the block. Is there a clean and efficient way to do this?

View 4 Replies View Related

Forms :: Get Data From Ref Cursor On Oracle Forms?

Mar 14, 2012

How can i get data from Ref cursor on Oracle forms?

View 1 Replies View Related

Forms :: Cursor Move In Next Row

Oct 1, 2010

i have a form and i have just one field on it and it's item_type is "List Item" and list style is "Poplist"...

my requirement is , when i press tab then i want that my cursor move in next row.

View 3 Replies View Related

Forms :: Change The Cursor Style?

Jan 11, 2012

To change the mouse pointer in D2K, which is the built-in to be used?

View 1 Replies View Related

Forms :: Make Cursor At The Item

Jan 25, 2013

I have a button "clear" , I want when the button is clicked the items will be cleared and the cursor is at the first item, here is the

:emp.id:=null;
:emp.ename:=null;
:emp.sal:=null;
go_item('emp.id');

=>but the problem that the item changes color, but the cursor remains at the button "clear"

NOTE:
I used the "when-new-item-instance" trigger to change the color of text items

View 3 Replies View Related

Forms :: Fetch Data Through The Cursor?

Aug 22, 2010

I want to fetch the data through the cursor and cursor is getting the value of group_code through the variable 'a'. but when i am writing the code like this it is not coming.

My code is like this :

declare
a varchar2(400):='';
cursor c1 is select ref_no,ref_code,company_id from stock_detail where company_id=:global.company_id

[Code]....

View 2 Replies View Related

Forms :: Navigating With Mouse Cursor

Jan 16, 2013

i am migrating from forms 6i to forms 10g but i am facing a problem. when i enter to my new form and i try to navigate thru the items with my mouse the validation of the item doesn't work properly. the cursor change position but the functionality works like it is still in the first item. the validation work when you use enter or tab.the same thing when you try to fetch the LOV, the LOV of the first item is populated not where the cursor is positioned.

View 3 Replies View Related

Forms :: How To Join Tables In A Cursor

Feb 14, 2012

I'd like to join tables in a cursor.

I tried coding this way...

CURSOR studgrade_cur IS
SELECT g.stud_id, g.grade, subj_code, s.description
FROM studgrades g JOIN subjects s
ON(g.subj_code = s.subj_code)
WHERE stud_id = :Studentprofile.student_id;

but i got an error, saying:

Quote:encountered the symbol JOIN when expecting one of the following:

,; for group having intersect minus order start union where
connect

Is it not allowed to use JOIN statement in a cursor?

View 4 Replies View Related

Forms :: Delete A Record In A Cursor

Mar 3, 2012

this is just the continuation of my previous topic,

After I bound data into the textboxes, now I want to delete it when I mistakenly click on the same data twice.

this is my screenshot:

View 4 Replies View Related

Forms :: Updating A Record In A Cursor?

Mar 3, 2012

when I updated a record in my form check my screenshot: and clicked save button the result was:

as you can see in the message at the bottom, it has 18 records. And since my original data(subjects) are just 9. And also the grades that I input didn't display all.

This is my code in when-new-block-instance trigger:
DECLARE
CURSOR studgrade_cur IS
SELECT e.student_id, s.subject_code --, g.grade

[code]...

View 39 Replies View Related

Forms :: Invalid Cursor Using SYS_REFCURSOR

Apr 25, 2012

i have created a procedure to open a query using a reference sys_refcursor as output parameter. i referenced the cursor in a pl/sql and is working correctly. however it throws error "ORA-01001: invalid cursor ORA-01403: no data found" when use on the oracle forms builder.

create or replace procedure mrch.prc_proj_list (p_add_clause in varchar2, p_rec_set out sys_refcursor) as
begin
Open p_rec_set for
'Select mp2.REGION region, '||
' mp2.ID proj_id, '||
' mppm2.PHASE phase, '||
' mm2.muni muni_id, '||
' mm2.MUNINAME muni_name, '||
' nvl((select Sum(ma.AMOUNT) From MRCH.MRC_AGREEMENT ma '||
' Where ma.PROJECT_ID = mp2.ID '||
' And ma.PHASE = mppm2.phase '||
' And ma.MUNI = mm2.MUNI),0) agreement, '||
' nvl((Select Sum(NVL(ma.GREEN_BOOK_AMOUNT,0) + NVL(ma.GB_ADJUST,0)) From MRCH.MRC_ALLOCATION ma '||
[code]....

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved