PL/SQL :: Update Records In Such A Way That Each Student's Marks Are Copied In New Column
Oct 22, 2012
i have a requirement, wherein i have to update records in such a way that each student's marks are copied in a new column of the next student record.
View 10 Replies
ADVERTISEMENT
May 26, 2011
i have a table in my PD database which have more than 30,000 records .some records in a column say p_code is not tagged with code like '9876543'while other records are tagged in this column with code such as '19022345678'.
Now i want to update these records with tagging 1902 with each one .
View 26 Replies
View Related
Apr 3, 2012
Table : Customer
Cust_idNameid
227ABC1
227ABC2
227ABC3
228XYZ1
228XYZ2
228XYZ3
228XYZ4
In one oracle table (Customer) we have multiple cust_id based on that, we want to populate id column as cust_id record count.
I have id column right now null and want result same as above.
View 1 Replies
View Related
Jun 1, 2010
I am trying to update records in the target table based on the records coming in from source. For instance, if the incoming record is present in the target table I would update them in the target else I would simply insert. I have over one million records in my source while my target has 46 million records. The target table is partitioned based on calendar key. I implement this whole logic using Informatica. Looking at the informatica session log I find that the informatica code is perfectly fine but its in the update part it takes long time (more than 5 days to update one million records). find the TARGET TABLE query and the UPDATE query as below.
TARGET TABLE:
CREATE TABLE OPERATIONS.DENIAL_REGRET_FACT
(
CALENDAR_KEY INTEGER NOT NULL,
DAY_TIME_KEY INTEGER NOT NULL,
SITE_KEY NUMBER NOT NULL,
RESERVATION_AGENT_KEY INTEGER NOT NULL,
LOSS_CODE VARCHAR2(30) NOT NULL,
PROP_ID VARCHAR2(5) NOT NULL,
[code].....
View 9 Replies
View Related
Jun 6, 2013
I have a query where I'm trying to get one row for a student that is their academic program. A view PS_NTSR_PRGPLN_VW returns all active programs. This student has three.The query is pretty straightforward but I'm not getting any rows, and I think it is because I'n not using MAX(pe.effdt) correctly.
select * from PS_NTSR_PRGPLN_VW h
where h.emplid = 'xxxxxx'
AND h.institution = 'ABCD'
AND h.acad_plan_type = 'MAJ'
AND h.primary_indicator = 'Y'
[code]....
I've had rows where I have the same plan_sequence so I do need to use MAX(pe.effdt), but when I do I get zero results.
View 1 Replies
View Related
Aug 26, 2011
i have one project about school system.there is one column of total marks.and other one is position column.i want a trigger that system genrate the position against total marks. problem is this when total marks become equal for example 101 and 101 than position also same.but dont now what a trigger i write for this.here some example
if total marks 100 than position is 1stand if total marks 99 than position is 2ndbut third person is also same number in total marks column i mean 99 than in position column must write the 2nd
View 4 Replies
View Related
Mar 14, 2013
I'm trying to create a histogram based on time range using a bar chart. I made the query correctly and the bar chart displays the histogram.
However I want to make the axes labels on the x-axis go under the tick marks of the axis. Right now they are under the corresponding bar. This doesn't convey the notion of a range. For e.g. if I have 23 observations between 10 and 20 seconds, I need to show 10 on the left of the bar and 20 on the right. In other words the bar is between two tick marks. I want to show 10 under the left tick mark and 20 under the right tick mark.
How do I do this? I tried using the attributes of the label tag under x_axis in the chart xml, but couldn't get it to work.
View 1 Replies
View Related
May 6, 2010
I have a table formatted like this
ID|First Name|Second Name
1|X|X
2|X|X
3|X|X
4|X|X
and I want to insert First Name and Second Name records using the ID as the reference. The new data is currently in a .csv file, but I could put them in another table if that's easier.
ID|First Name|Second Name
1|Adam|Adamson
2|Ben|Benson
3|Chris|Christophers
4|Dave|Davidson
I understand how to do individual updates, I want to know how it is possible for me to do this as one query, as I have several thousand records to update.
View 14 Replies
View Related
Jun 21, 2013
I want to update a table 8 million records of a table which has 10 millions records, what could be the best strategy if the table has a BLOB column with 600GB worth of data. BLOB itself is 550GB. I am not updating the BLOB column. Usually with non-BLOB data i have tried doing "CREATE TABLE new_table as select <do the update "here"> from old_table;" method .
View 6 Replies
View Related
Feb 2, 2012
I'm working with Oracle 10g.
I have a table like this;
ID Amount Date
123 5000 Oct-07-2011
123 null Oct-09-2011
124 7000 Oct-14-2011
124 null Oct-17-2011
124 null Oct-24-2011
What I'm trying to do here is loop thruogh the records and update the amount that's null with the previous amount with the same ID.
View 3 Replies
View Related
Nov 4, 2009
CREATE TABLE "SCOTT"."SEATALLOTMENT"
("YEAR" NUMBER(4,0),
"COLLEGECODE" CHAR(4 BYTE),
"COURSECODE" CHAR(3 BYTE),
[Code].....
Now i want to UPDATE reducing the AVAILABLE column by 1 in COURSESEATS table based on common columns collegecode,coursecode for a ROW inserted into SEATALLOTMENT table ,i am confused to what approach i have to follow whether its a procedure or a trigger
CASE:
Here in this case as i insert a row with krcl,cse as college code and course code respectively into seatallotment table the available column in courseseat table for the respective row with mentioned common column must become 59 from 60
View 5 Replies
View Related
Jul 29, 2013
I need to update more than 1million records in a table. I am using Oracle Warehouse Builder to do this Job. it is taking more than 3 hours still running. I don't have any Indexes on this table.
View 11 Replies
View Related
Sep 20, 2011
The requirement is I have a table (TAB1), wherein I have 3 columns, ID, LID and STATUS.
The value in ID column = ID_SEQ.NEXTVAL,and LID will be either 0 or 1 and the possible values for STATUS are 'ED','CP', NULL. The ID column is not suppose to have duplicate values, but there is no check on the table for the same.
Someone has updated the existing data and ID column is containing duplicate values. Wherever LID = 0 and STATUS = NULL and if only if ID is duplicated then the ID_SEQ.NEXTVAL has to be assigned to ID field, so that there are no more duplicate values.
CREATE TABLE tab1 (id NUMBER , lid NUMBER, status VARCHAR2(10));
Existing Data
------------------
INSERT INTO tab1 VALUES (1,0, 'ED');
INSERT INTO tab1 VALUES (1,0, 'CP');
INSERT INTO tab1 VALUES (1,0, NULL);
INSERT INTO tab1 VALUES (1,0, NULL);
INSERT INTO tab1 VALUES (1,0, NULL);
INSERT INTO tab1 VALUES (1,0, NULL);
[code]....
get the result using a single update statement.
View 5 Replies
View Related
Sep 21, 2012
Lets take the basic emp table for our Referenece and lets assume that it contains around 60000 Records and all the deptno in that table are Initially 10. Please provide an update statement which would update deptno column of EMP table((based on) order by EMPNO) in for every 120 records incrementing by 1.(DeptNo to be incremented by 1,like 10 ,11 , 12 etc).
First 120 Records deptno should be 10,
Next 120 Records deptno should be 11, and so on.
.
.
.
.
.
.
For Last 120 records deptno should be updated with 500.
View 3 Replies
View Related
Aug 23, 2013
When a table structure is copied from another table.What are the constraints copied and why?Unique keyPrimary keyForeign KeyCheckNot null.
View 10 Replies
View Related
Nov 20, 2009
want to update 230 records in ins_spr table but its returning error..
Sql statement in blue color returning 230 records.
------------------------------------------------
update ins_spr set
SPR_EXCC = 'NORSk'
where spr_code = (select distinct spr_code from ins_spr where spr_levc = 'N' and spr_facc = 'ROS' and (sts_code = 'AP' or sts_code = 'LS') and spr_stuc in (select distinct a.sqe_stuc from srs_sqe a where a.SQE_EQEC = 'NP3M' and a.SQE_SQSC = 'BE' and a.sqe_stuc in ( select distinct b.sqe_stuc from srs_sqe b where a.sqe_stuc=b.sqe_stuc and SQE_EQEC = 'NP3S' and SQE_SQSC = 'BE')))
OR
update ins_spr set
SPR_EXCC = 'NORSK'
where spr_code = (select spr_code from ins_spr where spr_levc = 'N' and spr_facc = 'ROS' and (sts_code = 'AP' or sts_code = 'LS')
and exists (select sqe_stuc from srs_sqe a where sqe_stuc = substr(spr_code,1,8) and SQE_EQEC = 'NP3M' and SQE_SQSC = 'BE'
and exists ( select sqe_stuc from srs_sqe b where a.sqe_stuc=b.sqe_stuc and SQE_EQEC = 'NP3S' and SQE_SQSC = 'BE')))
View 1 Replies
View Related
Dec 21, 2012
I am trying to insert rec into target table if those rec are not existing and trying to update those rec if they already exists from three source tables.I had seen in posts that merge cannot be used with cursor.
SQL> create or replace
2 PACKAGE sis_l_cpl_sis_reb_pgm_hist_pkg
3 IS
4 /********************************************************************
******************
5 PACKAGE: sis_load_cpl_sis_reb_pgm_hist
6 PURPOSE: Load CMPLY_SIS_REB_PGM_HIST with data from cmply_sis_p
h_dtl,cmply_sis_sls_dtl,
7 cmply_sis_excl_dtl(intial load)
8 *********************************************************************
******************/
[code].......
Package created.
SQL> create or replace
2 PACKAGE BODY
sis_l_cpl_sis_reb_pgm_hist_pkg
3 IS
4 /**********************************************************************
******************
5 PACKAGE: sis_l_cpl_sis_reb_pgm_hist_pkg
6 PURPOSE: Load CMPLY_SIS_REB_PGM_HIST with data from cmply_sis_pur
h_dtl,cmply_sis_sls_dtl,
7 cmply_sis_excl_dtl(intial load)
[code].......
Warning: Package Body created with compilation errors.
SQL> sho err
Errors for PACKAGE BODY SIS_L_CPL_SIS_REB_PGM_HIST_PKG:
LINE/COL ERROR
-------- -----------------------------------------------------------------
67/7 PL/SQL: SQL Statement ignored
75/19 PL/SQL: ORA-00926: missing VALUES keyword
View 10 Replies
View Related
Sep 16, 2013
what are the type of ways to update the 10 million records table with certain condition?
View 2 Replies
View Related
Mar 25, 2013
My table have duplicate records. I want to impose a primary key on that table. For that I have to replace duplicate values of a column with next value of a sequence.
View 2 Replies
View Related
Feb 27, 2013
I want to update records which returns more than 1 row using store procedure. i tried with ref_cursor but failed to update,
View 1 Replies
View Related
Feb 27, 2013
i am trying to update multiple records using store procedure but failed to achieve
for example my source is
emp_name sal
abhi 2000
arti 1500
priya 1700
i want to increase salary of emp whose salary is less than 2000 it means rest two salary should get update..using stored procedure only
i have tried following code
create or replace procedure upt_sal(p_sal out emp.sal%type, p_cursor out sys_refcursor)
is
begin
open p_cursor for
select sal into p_sal from emp;
if sal<2000 then
update emp set sal= sal+200;
end i;f
end;
and i have called the procedure using following codes
set serveroutput on
declare
p_sal emp.sal%type;
v_cursor sys_refcursor;
begin
upt_sal(p_sal,v_cursor);
fetch v_cursor into p_sal;
dbms_output.put_line(p_sal);
end;
the program is executing but i should get o/p like this after updating
1700
1900
but i am getting first row only
2000
and record is not updating...
View 15 Replies
View Related
Jun 17, 2013
I have a table which is updated with new records in each 15minutes from network. In order to get the accurate information I must do some arithmetic calculations on some variables.
For example, if the value for column A is 10 @9.45AM and 15 for @10AM the real result should be 15-10=5 for 10AM; because the values are cumulative so I need to subtract. Similar to this I have same operations for 9 more attributes in my table as well.
In order to handle this I used view and did necessary operations by using joining table like this (table name is Operations lets say and id is Primary Key)
create view ....
...
from Operations current, Operations prev
where current.datetime(+) = prev.datetime - 1 / 96
and current.id = prev.id
When I use this view, the simple select query takes about 15min since I have 25GB record for this table. What can I use instead of this join and solve cumulative values issue?
View 3 Replies
View Related
May 29, 2010
I want to update / insert records from one user to other user therefore I write this code in my form but it gives me error.
REPORT_DETAILS is a detail table of REPORT_PARAM, given code is working fine at master tables.
Form always goes in TOO_MANY_ROWS exception.
Correct my code, my requirement is: if data found then update else insert new record.
declare
cursor c1 is select * from factory_data.report_details order by rd_rp_id;
rec c1%rowtype;
v_check varchar2(1) := null;
begin
for rec in c1 loop
[code].......
View 7 Replies
View Related
Mar 12, 2013
My oracle version is oracle 9i
I need to commit after every 2000 records.Currently am using the below statement without using the loop.how to do this?
do i need to use rownum?
BEGIN
UPDATE
(SELECT A.SKU,M.TO_SKU,A.TO_STORE FROM
RT_TEMP_IN_CARTON A,
CD_SKU_CONV M
WHERE
[Code].....
View 8 Replies
View Related
Jan 31, 2011
how can i prevent an item from being copying. I mean to say user will not able to copy the value from the item and paste in notepad.
The item will be enabled also i can not desable it.
View 9 Replies
View Related
Dec 28, 2010
I was wondering how can I do below statement in oracle
update table1 t1 set t1.column1 = t2.column2
from table2 t2 inner join table3 t3 on t3.column3=t2.column4
where t3.column5 is null
I tried read up merge and update, but not really understand how the syntax works in oracle.
View 2 Replies
View Related
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
May 4, 2013
I am doing partitioning in the table ap_invoices_all and i have gone through all the process of i am making a script for a table and process
1. Create the new partitioned table with the same column structure as the original and with the partitions.
2. Insert data from the original table to the partitioned. Use parallel DML.
3. Rename the indexes of the original table
4. Create indexes to the partition table with the same columns as the original indexes.
5. Save the source code of the original table triggers
6. Rename the triggers of the original table to OLD
7. Do the table renaming. Rename original table to OLD and the partitioned table to original.
8. Drop the synonyms for the OLD table and recreate to point to the new partitioned
9. Grant the appropriate privileges to new partitioned table.
10. Create the triggers to the partitioned table
i want to know do i need to copy the constraints of the original table to the partitioned table?
View 10 Replies
View Related
Jul 2, 2011
We have Oracle 10G dataguard configured,
DGMGRL -
Show configuration;
Shows status "SUCCESS"
Also
Archive log list
shows the proper archives in PROD as well as DR
But, when we check the Archive Applied ="YES" its shows result as "BLANK"
View 2 Replies
View Related
Dec 14, 2011
Question: does oracle recover past the scn mentioned in the control file or do you need recover using backup control file for it? No specific scn,time specified.
Scenario: Restore database on new server + copy archivelogs from original to minimize data loss.
Backup : 5 AM
Archivelogs: 7 AM
New server:
Configure dummy instance
Restore spfile from tape
Restore controlfile from tape: SCN 5AM
Restore database (no scn specified) from tape: : SCN 5AM
Copy archivelogs from old server to archivelog new location: SCN 7AM.
Recover database
open database -> SCN 5AM or 7AM?
Does it recover till SCN 5AM (controlfile) or SCN 7AM (latest scn in copied archivelog)
View 2 Replies
View Related