SQL & PL/SQL :: Trigger To Copy Data From One To Another Table
Jun 28, 2010
1. I am inserting a value to a table.through uploading the csv file to the DB table using apex.
2. After the data get inserted into the table(parent),my data should be copied to the another table with some conditions .
3. Is it possible to write a trigger to insert statement from selecting the values from another table.
View 5 Replies
ADVERTISEMENT
Feb 14, 2013
I have two tables one is
1)create table abc(c_name varchar2(10),c_number number(6),c_loc varchar2(8)); --having values
2)create table temp(sname varchar2(10),sid number(4),address varchar2(10));---no having
and my question is how to insert a values into temp using when-button-pressed trigger based on abc table in oracle form.
View 16 Replies
View Related
Apr 30, 2010
i could copy data from tableA to tableB with the scenario below
1) Currently we have no unique key / primary key defined on both of this tables, due to the nature of data, so insert/update will not work
2) We cant truncate/insert as user will be accessing this tables when the copying process takes place, so we dont want to end up having a scenario where the table does not contain data at a certain time
Will materialize view full refresh work in refreshing a table so we could avoid the problem faced in point 1 & 2.
View 7 Replies
View Related
Feb 11, 2013
I have two tables namely PERSON and WIFE. I want to make WIFE's data available in PERSON table while keeping entries of WIFE maintained and at the same time adding some the values of PERSON against the data of wife.
PERSON Table
PK NAME ADDRESS IS_MARRIED
1 John ab city Y
2 Varvatos cd town N
3 Smith ef town Y
4 Henry gh city Y
5 Lynda gh city Y
WIFE table
PK PERSON_ID (FK) NAME
1 1 Alice
2 3 Rosy
3 4 Lynda
Now i want to copy data of WIFE table into PERSON table like this PERSON table
PK NAME ADDRESS IS_MARRIED
1 John ab city Y
2 Varvatos cd town N
3 Smith ef town Y
4 Henry gh city Y
5 Lynda gh city Y
6 Alice ab city Y
7 Rosy ef town Y
As in the given example you might have noticed that ADDRESS of wife is same as of her spouse and same goes for IS_MARRIED column. Moreover, the PK is also not duplicated. How to go about this?
Another important factor is Lynda already exits in PERSON table, therefore, i certainly don't want to duplicate her entry.
View 8 Replies
View Related
Dec 20, 2011
how to copy data and constraints from one table to another table
View 8 Replies
View Related
Oct 5, 2010
i have a table COLOR having alphanumeric fields i.e Color Description & Color Ref. i want to copy the values from Color Description to Color Ref.
what will the select statement for this?
View 9 Replies
View Related
Jul 9, 2008
Triggers for oracle database. What I am trying to do is copy original data from one table to another table prior to an update, insert, or delete occurring. Basically we are trying to keep a transactional history, with out having to restore the data. Here is what I have created to date, however it is not executing consistently.
CREATE OR REPLACE TRIGGER DATA_COPY BEFORE
INSERT
OR DELETE
OR UPDATE ON "DB1"."TABLE_1"
[code].......
View 10 Replies
View Related
Nov 16, 2010
I have 2 tables with same no of column and range partition based on date.At the end of month i want to copy the data of one table to another table.Instead of copy the data i want to copy the data of one partition completely to another table partition ..
View 2 Replies
View Related
Feb 27, 2012
i have a table with 15 coulums and containing millions of rows which is being updated everyday.Now i have created a similar report table with only the coulums i need to report on from the main table.what plsql script or if there is any better alternative do i need to write to copy the data from the coulums i need from the main table to the new report table. the new report table will be be updated every 01:00am with the data coming from the main table and the update is automated.
View 3 Replies
View Related
Nov 7, 2010
I would like to create a trigger on a table which populates a log table. In addition to using the table where the trigger will exist, I would like to populate a couple more fields in the log table with with data from 2 other tables.
e.g.
NAME_TABLE
-reg_id
-name
ADDRESS_TABLE *trigger to be fired when a new record is created here.
-reg_id
-srv_id
PROCESS_TABLE
-srv_id
-start_time
-end_time
This is what I would like the logging table to look like:
LOGGING_TABLE
-address_table_reg_id
-address_table.srv_id
-name_table.name
-process_table.start_time
-process_table.end_time
How can I go about creating this type of trigger?
View 2 Replies
View Related
Aug 24, 2011
I know this is an old thread and I just started working with triggers. I want to check if the data being inserted is already in the table and if not insert it:
create or replace trigger t_triggername
before insert on tbl_tablename
for each row
begin
if(:new.user_id <> :old.user_id) then
insert into tbl_tablename(user_id, location)
values (:new.user_id, :new.location);
end if;
end;
what if I wanted to keep the user but only update location if the user is already in the table. I've tried doing it this way:
create or replace trigger t_triggername
before insert on tbl_tablename
for each row
begin
if(:new.user_id <> :old.user_id) then
insert into tbl_tablename(user_id, location)
[code]...
View 4 Replies
View Related
Sep 20, 2011
i need a trigger with alter commands to alter the table structure,it will be captured in a separate meta data table(META)
CREATE OR REPLACE TRIGGER meta_alter AFTER Alter ON SCHEMA
BEGIN
update meta set column_name=:new where table_name=ora_dict_obj_name column_name=:old;
END;
/
Meta table contains Table name and column name..i attached the table data in atext file
View 39 Replies
View Related
Oct 12, 2012
I want copy some tables from one database to another. Which of following is the fastest way:
- INSERT /*+APPEND*/ via database link
- Transportable Tablespaces
- datapump IMP/EXP (I supposed it's the slowest way)
View 2 Replies
View Related
Mar 15, 2010
we have a prod DB and an Backup DB. I have been asked to copy selected tables from prod Db to anaylsis DB on a weekly basis. Db version is 9i.
Can I use Db links here?, but the data is huge.
View 1 Replies
View Related
Jun 18, 2012
I am developing an application for making the travel entries for my organization employees.
For that purpose I have 3 datablocks named:
1) Travel header
2) Employee Detail
3) Travel Detail
which are interlinked through constraints.
I want to give 2 options ie. either single booking entry or Group booking entry.
The form is working properly for single booking entry. But when I want to make a group booking wherein many employees have to travel between common locations I have to fill all the travel details again for all employees. I want to avoid that since it wont give a feasibility for this application. I can copy the travel details I have entered for the 1st employee. I am uploading the form layout.
View 3 Replies
View Related
Mar 2, 2011
I have this remote database A and database B. DB A has 10 views and DB B has 10 tables. I have to pull out data from views of DB A and load into tables of DB B at regular intervals. How do I do this job?
View 3 Replies
View Related
Jan 10, 2013
I have a diskgroup with normal redundancy level (2 two failure groups) working fine. I desire add a new failgroup to diskgroup (changing the redundancy level to high).
Which ASM process will manage the copy of data to new failgroup? Are there some way to control or tuning this process?
View 1 Replies
View Related
Oct 9, 2013
i want table data exported to txt file, data is around 3200000,
View 14 Replies
View Related
Aug 27, 2013
I have control block. In which user enters two values. Next is data block in which two items have property 'copy value from item' set to 'control block.item1' and 'control block.item2' resp. If thees items are made database items then in execute query will they be sent as parameters in addition to default where clause? if I check last query then query does not hv these parameters but the records returned are already filtered by control block items.
View 1 Replies
View Related
Jan 27, 2012
I am very new to oracle and SQL.I am trying to create a store proc that will copy 14 day of data into a table and then truncate the original table. When i compile following code....
CREATE OR REPLACE PROCEDURE STOPROC_TRUNCATE
( dateNum IN NUMBER )
IS
BEGIN
create table AUDIT_14Days as select * from AUDIT where TIMESTAMP >= (SYSDATE - dateNum);
truncate table AUDIT drop storage;
[code]....
View 8 Replies
View Related
Apr 20, 2010
i need to copy data from certain table's from one DB to another at random intervals. Table structure for the one's getting copied can be same in both the DB.
After reading various posts here i have understood that it can be done using Oracle Replication and Oracle stream.
how these 2 methods work and how they are different from each other.
View 4 Replies
View Related
Jul 10, 2012
I'm cloning a database from an existing dbca template. The clone is failing with datafile does not exist, because during the copying step, all the datafiles' name are changed, how do I force it to force dbca to keep the same names from the original database?
View 3 Replies
View Related
May 21, 2006
Is it possible to copy a value in a column from a table into another column in another table using the select statement.
Example: I want to copy the arrival date from the guest table to date_charge in the charges table.
CREATE TABLE GUEST
(ROOM_NUMBER VARCHAR2(2),
DATE_ARRIVAL DATE DEFAULT SYSDATE NOT NULL);
CREATE TABLE CHARGES
(ROOM_NUMBER VARCHAR2(2),
DATE_CHARGE DATE default Sysdate);
[code]....
View 6 Replies
View Related
Jul 26, 2011
shall we stop inserting data into a table before it inserting using Trigger?
View 3 Replies
View Related
May 22, 2010
I need any good suggestion basically I have two different location
1- Factory
2- Head office
I have developed PRODUCTION module in factory and it is working fine and now I want to send data on daily basis to head office therefore I develop a form which will create backup in export format (.dmp) then user will send via email to head office.
Backup file should be save in pre-defined location then user will use a form which I developed for loading data into head office there are two different buttons in this form;
First is used to load data, actually first I load data in a temporary user which creates whenever user will press this button. Second is used to copy data in application user but first it checks if data exists then update otherwise insert.
View 1 Replies
View Related
Nov 26, 2010
We are copying our transaction tables data into another database for our reporting applications (say every day midnight refresh will happen).
The Transaction Database has some 30tables. Existing system is following below points and it is taking 2hours to complete.
1) Truncate data from reporting database (or schema)
2) Direct path Insert into reporting database (or schema) as select * from transaction tables.
3) Rebuild index and Enable constraints.
Note: Each tables data will vary from 30lakhs to 50lakhs. Dump/import/export is not advised by the client.
I want to cut down the time i.e., below 2hours. Instead of above method. Can go for a field in each table specifying the time of each records update/insert operation and then pick the modified records only and copy into reporting db.
View 4 Replies
View Related
Mar 7, 2012
I am working on a form having three data blocks
Travel_Inconvineance (Master)
TI_Card_Info (Detail)
TI_Limit_Indemnity (Detail)
On working TI_Card_Info i have 2 columns Plastic_Card_Id and Plastic_Card_Type which i want to be paste on TI_limit_Indemnity data block as i enter in TI_Card_Info.
View 1 Replies
View Related
Sep 15, 2013
im on 11G R2 database on linux 5.4, while configuring a physical standby from scratch, remember i dont want to use RMAN, when i copy datafiles from primary to standby, is it necessary to shutdown primary and then copy datafiles ? or i can use SCP command and copy even though primary is up in read write mode?
View 4 Replies
View Related
May 27, 2010
How can i copy a single column from one table to another. Table 1 has a column with data in it, table 2 has the column but is empty, i want to copy data for a single column from table1 to table 2. By the way these table have multiple columns.
View 8 Replies
View Related
Nov 24, 2012
I must admit my "google skills" have failed me and it is possible that I might be missing something obvious here but allow me to explain.
If I have a table that is populated/accessed by a typical OLTP application such that over time the data in the table may become "fragmented".
I know that is a very controversial term I used but that is not the question here. A simple way to describe the state of the table might be that the table has always been populated with lots of small INSERTs, modified with lots of small UPDATEs and data has been deleted in small DELETEs.
This has meant that the data is neither closely stored in data blocks nor is in any particular order (so there are some empty blocks under HWM).
Now my question is how do I create exact copy of this table and its indexes AS THEY EXIST AT THE MOMENT that includes
1) its data
2) its constraints/indexes etc.
3) its storage parameters
4) data stored in EXACTLY same manner as in original table.
To avoid complications, the table in question is just a normal heap table without any partitioning involved. While
CREATE TABLE AS SELECT (or CREATE TABLE followed by INSERT) will take care of points (1) to (3) above, it will not achieve point (4) above.
View 11 Replies
View Related