Insert / * + append * / into TableName Select / * + parallel (t, 4, 1) * / * from Tabl
HelloI use
Insert /*+ append */ into TableNew select /*+ parallel( t,4,1) */ * from TableOld t
to load data into a table through TableNewanother table of the same structure - TableOld
More than 4-5 hours it takes me to do this for about 1.5 million lines with a column defined as XMLType as well.
-Are there any rules to determine the degree of parallelism, or is he just hit and a trial?
- Or set none and let the optimizer?
-Any other rule, I keep in mind to try to optimize this operation?
Thank you...
Published by: BluShadow on December 6, 2012 11:20
addition of {noformat}
{noformat} tags for readability. Read: {message:id=9360002} and learn to do this yourself
Ben hassen says:
user8941550 wrote:
So I tried,Insert / * + append * / into TableNew select * from TableOld t
and it is now running in an hour.No explanation for this.
I don't recommend this way (insert into... Select..) for large tables.
Because you have no ability to run a commit when inserting (first at the end of the insertion process that you can commit).
It takes much more space-cancellation (if you run rollback after the insert statement).
But, principal in blocks or pieces is not a transactional point of view and can cause more problems later if there is an error in one of the blocks of inserts, because you will not be able to easily restore data that has already been posted.
I highly recommend to use a single INSERT. SELECT... statement in most cases (it's always going to be rare exceptions), simply to maintain transactional integrity.
A better way is, define a cursor, read for blocked lines (e.g. 1000 lines), after every 1000 lines run a commit.
That's a great way to a) slow down the process and b) make it difficult to restore it if a problem occurs.
Whenever you issue a commit, it tells Oracle to write the data in the data files. Which is performed by the writer processes. By default, the database starts with N number of processes of writer ("N" depends on the configuration of database, so let's assume 4 processes of writer for example). Whenever a commit is issued, a writer process gets allocated to the task of writing the data to the data files as defined. The workload is shared between these processes, so if a further validation is issued and a single process for writer is already busy, then another process will consider this request. If the database starts to do a lot of approvals issued, and concludes that all the existing processes of the writer are busy, it will generate new writer processes to process new requests, taking up more resources (memory, files, and processes handles etc.) server and the writer process more, there is more chance they have of creating States of waiting between them as they all try and write to the data files (same) especially if the data is committed are closely for example same table and associated tablespace etc.). These resources are not released again when the tasks are complete, until the server is restarted or the stop of the Oracle, Oracle keeps them there in waiting, it will get the same kind of workload once again. Oracle is perfectly capable of treating millions of lines, suggesting that it is 'better' to insert into pieces of 1,000 records at a time, having committed after each, not only slows down the process of pl/sql code perspective, but also slows down things from a server resources point of view, as well as causing potential claim to IO file issues... including the possibility of having some i/o contention problems with disks. It is certainly NOT "a better way".
These suggestions are usually given by people who do not understand the underlying architecture of databases Oracle, something which is taught on the Oracle DBA courses, and it's a course I would recommend that any so-called professional developer attends, even if they did not intend to be a DBA. How works the architecture of a database is probably useful to know how to write good code... not only in the Oracle, but some other RDBMS establishments (when I was a developer of Ingres database, I have followed the courses of Ingres DBA and it was also valuable to understand how to write good code).
Tags: Database
Similar Questions
-
Difference in performance between the CTA and INSERT / * + APPEND * / IN
Hi all
I have a question about the ETG and "Insert / * + Append * / Into" statements.
Suite deal, I have a question that I did not understand the difference in operating times EXADATA.
The two tables of selection (g02_f01 and g02_f02) have not any partition. But I could partition tables with the method of partition by column "ip_id" hash and I tried to run the same query with partition tables. Change anything in execution times.
I executed plan gather statistics for all tables. The two paintings were 13.176.888 records. The two arrays have same "ip_id' unique columns. I want to combine these tables into a single table.
First request:
Insert / * + append parallel (a, 16) * / in dg.tiz_irdm_g02_cc one
(ip_id, process_date,...)
Select / * + parallel (a, 16) parallel (16B) * / *.
tgarstg.tst_irdm_g02_f01 a.,
tgarstg.tst_irdm_g02_f02 b
where a.ip_id = b.ip_id
Elapsed = > 45: 00 minutes
Second request:
create table dg.tiz_irdm_g02_cc nologging parallel 16 compress for than query
Select / * + parallel (a, 16) (b, 16) parallel * / *.
tgarstg.tst_irdm_g02_f01 a.,
tgarstg.tst_irdm_g02_f02 b
where a.ip_id = b.ip_id
Elapsed = > 04:00 minutes
Execution plans are:
1. Enter the statement execution Plan:
Hash value of plan: 3814019933
------------------------------------------------------------------------------------------------------------------------------------------
| ID | Operation | Name | Lines | Bytes | TempSpc | Cost (% CPU). Time | TQ | IN-OUT | PQ Distrib.
------------------------------------------------------------------------------------------------------------------------------------------
| 0 | INSERT STATEMENT. | 13 M | 36G | | 127K (1) | 00:00:05 | | | |
| 1. LOAD SELECT ACE | TIZ_IRDM_G02_CC | | | | | | | | |
| 2. COORDINATOR OF PX | | | | | | | | | |
| 5: PX SEND QC (RANDOM). : TQ10002 | 13 M | 36G | | 127K (1) | 00:00:05 | Q1, 02 | P > S | QC (RAND) |
|* 4 | IN THE BUFFER HASH JOIN | | 13 M | 36G | 921 M | 127K (1) | 00:00:05 | Q1, 02 | SVCP | |
| 3: RECEIVE PX | | 13 M | 14G | | 5732 (5) | 00:00:01 | Q1, 02 | SVCP | |
| 6. PX SEND HASH | : TQ10000 | 13 M | 14G | | 5732 (5) | 00:00:01 | Q1 00 | P > P | HASH |
| 7. ITERATOR BLOCK PX | | 13 M | 14G | | 5732 (5) | 00:00:01 | Q1 00 | ISSUE | |
| 8. STORE TABLE FULL ACCESS | TST_IRDM_G02_F02 | 13 M | 14G | | 5732 (5) | 00:00:01 | Q1 00 | SVCP | |
| 9. RECEIVE PX | | 13 M | 21G | | 18353 (3) | 00:00:01 | Q1, 02 | SVCP | |
| 10. PX SEND HASH | : TQ10001 | 13 M | 21G | | 18353 (3) | 00:00:01 | Q1, 01 | P > P | HASH |
| 11. ITERATOR BLOCK PX | | 13 M | 21G | | 18353 (3) | 00:00:01 | Q1, 01 | ISSUE | |
| 12. STORE TABLE FULL ACCESS | TST_IRDM_G02_F01 | 13 M | 21G | | 18353 (3) | 00:00:01 | Q1, 01 | SVCP | |
------------------------------------------------------------------------------------------------------------------------------------------
Information of predicates (identified by the operation identity card):
---------------------------------------------------
4 - access("AIRDM_G02_F01".") IP_ID '= 'AIRDM_G02_F02'.' IP_ID")
2 - DEC execution Plan:
Hash value of plan: 3613570869
------------------------------------------------------------------------------------------------------------------------------------------
| ID | Operation | Name | Lines | Bytes | TempSpc | Cost (% CPU). Time | TQ | IN-OUT | PQ Distrib.
------------------------------------------------------------------------------------------------------------------------------------------
| 0 | CREATE TABLE STATEMENT. | 13 M | 36G | | 397K (1) | 00:00:14 | | | |
| 1. COORDINATOR OF PX | | | | | | | | | |
| 2. PX SEND QC (RANDOM). : TQ10002 | 13 M | 36G | | 255K (1) | 00:00:09 | Q1, 02 | P > S | QC (RAND) |
| 3. LOAD SELECT ACE | TIZ_IRDM_G02_CC | | | | | | Q1, 02 | SVCP | |
|* 4 | HASH JOIN | | 13 M | 36G | 1842M | 255K (1) | 00:00:09 | Q1, 02 | SVCP | |
| 5. RECEIVE PX | | 13 M | 14G | | 11465 (5) | 00:00:01 | Q1, 02 | SVCP | |
| 6. PX SEND HASH | : TQ10000 | 13 M | 14G | | 11465 (5) | 00:00:01 | Q1 00 | P > P | HASH |
| 7. ITERATOR BLOCK PX | | 13 M | 14G | | 11465 (5) | 00:00:01 | Q1 00 | ISSUE | |
| 8. STORE TABLE FULL ACCESS | TST_IRDM_G02_F02 | 13 M | 14G | | 11465 (5) | 00:00:01 | Q1 00 | SVCP | |
| 9. RECEIVE PX | | 13 M | 21G | | 36706 (3) | 00:00:02 | Q1, 02 | SVCP | |
| 10. PX SEND HASH | : TQ10001 | 13 M | 21G | | 36706 (3) | 00:00:02 | Q1, 01 | P > P | HASH |
| 11. ITERATOR BLOCK PX | | 13 M | 21G | | 36706 (3) | 00:00:02 | Q1, 01 | ISSUE | |
| 12. STORE TABLE FULL ACCESS | TST_IRDM_G02_F01 | 13 M | 21G | | 36706 (3) | 00:00:02 | Q1, 01 | SVCP | |
------------------------------------------------------------------------------------------------------------------------------------------
Information of predicates (identified by the operation identity card):
---------------------------------------------------
4 - access("AIRDM_G02_F01".") IP_ID '= 'AIRDM_G02_F02'.' IP_ID")
Oracle version:
Oracle Database 11 g Enterprise Edition Release 11.2.0.4.0 - 64 bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE Production 11.2.0.4.0
AMT for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production
Notice how this additional distribution has disappeared from the non-partitioned table.
I think that with the partitioned table that oracle has tried to balance the number of slaves against the number of scores he expected to use and decided to distribute the data to get a 'fair sharing' workload, but had not authorized for the side effects of the buffer hash join which was to appear and extra messaging for distribution.
You could try the indicator pq_distribute() for the insert to tell Oracle that he should not disrtibute like that. for example, based on your original code:
Insert / * + append pq_distribute parallel (a, 16) (a zero) * / in dg.tiz_irdm_g02_cc one...
This can give you the performance you want with the partitioned table, but check what it does to the space allocation that it can introduce a large number (16) of extensions by segment that are not completely filled and therefore be rather waste of space.
Concerning
Jonathan Lewis
-
Insert, append and alter truncate partition table
Hi all
My DB is 11.2 Exadata machine. I've done the migration of data from PROD and PROD team says that my DML blocked their DDL. I want to get confirmed here until I have send an email to defend myself.
My DML is
Their DDL resemblesinsert /*+ append noparallel(t) */ into GPOS_XXX_XXX PARTITION(p3) t SELECT /*+ noparallel(s)*/* FROM GPOS_XXX_XXX@adw3u_izoom_admin s WHERE srce_sys_id = 1; commit;
I did the test and it shows as they were running at the same time very well, busy resource no error will be thrown.ALTER TABLE GPOS_XXX_XXX TRUNCATE PARTITION p4
Don't miss something here, please?
Best regards
Leon>
Don't miss something here, please?
>
I don't think so. I did a test on 11 GR 2 and there is no conflict. I think that your team of prod is wrong. Ask them to provide a quote to support their application.As long as your access direct-path INSERT specifies a particular data then only this partition will be locked.
See this blog asktom since last year where he addresses a question similar to, but not the same thing as, to yours.
http://asktom.Oracle.com/pls/Apex/f?p=100:11:0:P11_QUESTION_ID:3580062500346902748
>
APPEND it (or parallel direct path load) crashes the segment it targets. But the table lock prevents only the other inserts/changes - NO of QUERIES.And also, if you know that you insert in a single partition and you
Insert / * + append * / into table partition (pname) select...
Then only THIS partition will be locked.
-
How to insert values into a view created on multiple tables
Hi all
My goal for insert values in a view
So for this I created a trigger
then I tried to insert the value in the view, im getting as inserted row, but the value is not getting inserted
Here are the steps I followed:
SQL > create table (x int primary key)
2.
Table created.
SQL > create table b (x references a, varchar2 (30)) y
2.
Table created.
SQL > insert into a values (1)
2.
1 line of creation.
SQL > insert into b values (1, 'One')
2.
1 line of creation.
SQL > create or replace view v
2 as
3 select a.x, b.x as b_x, a y, and b where a.x = b.x
4.
Created view.
SQL > select * from v
2.
X B_X Y
---------- ---------- ------------------------------
1 1 a
SQL > create or replace trigger v_t
2 instead of inserting it on v
3 for each line
4 start
case 5: old.x <>: new.x then
6. Insert in a values(:new.x);
7 end if;
case 8: old.b_x <>: new.b_x then
9 insert into b values (:new.b_x,:new.y);
10 end if;
11 * end;
SQL > /.
Trigger created.
SQL > insert into v values (20,20, 'Twenty')
2.
1 line of creation.
SQL > select * from v
2.
X B_X Y
---------- ---------- ------------------------------
1 1 a
Can anyone suggest me a valid query to insert data into a view that is created on several tables.
Thanks in advance,
ShaliniHi Shalini,
You don't need the code if in your trigger.
That's more like code when you update, you don't compare OLD and insert the NEW values on.MHO%xe> create table a(x int primary key); Tabel is aangemaakt. Verstreken: 00:00:00.11 MHO%xe> MHO%xe> create table b(x references a,y varchar2(30)); Tabel is aangemaakt. Verstreken: 00:00:01.09 MHO%xe> MHO%xe> insert into a values(1); 1 rij is aangemaakt. Verstreken: 00:00:00.01 MHO%xe> MHO%xe> insert into b values(1,'One'); 1 rij is aangemaakt. Verstreken: 00:00:00.06 MHO%xe> MHO%xe> create or replace view v as 2 select a.x 3 , b.x as b_x 4 , y 5 from a 6 , b 7 where a.x = b.x; View is aangemaakt. Verstreken: 00:00:01.07 MHO%xe> MHO%xe> select * from v; X B_X Y ---------- ---------- ------------------------------ 1 1 One Verstreken: 00:00:00.04 MHO%xe> MHO%xe> create or replace trigger v_t 2 instead of insert on v 3 for each row 4 begin 5 insert into a values(:new.x); 6 insert into b values(:new.b_x,:new.y); 7 end; 8 / Trigger is aangemaakt. Verstreken: 00:00:01.64 MHO%xe> MHO%xe> insert into v values(20,20,'Twenty'); 1 rij is aangemaakt. Verstreken: 00:00:00.06 MHO%xe> MHO%xe> select * from v; X B_X Y ---------- ---------- ------------------------------ 1 1 One 20 20 Twenty
-
Insert into MDQ_OLD select * from table (lt_monitorMdq);
I'm trying to insert into a table that has only a single column, which is a column of a user defined type (UDT). The UDT is nested, that is one of the attributes of the UDT is an another UDT.
I aim to insert into the table like this pseudo-code:
INSERT INTO T1 SELECT * FROM THE UDT;
CREATE TABLE MDQ_OLD (myMDQ UDT_T_MONITOR_MDQ)
NESTED TABLE myMDQ
(T1_NEW) ACE STORE
THE NESTED TABLE MONITOR_MDQ_PRIM_RIGHTS
STORE AS T2_NEW);
The MONITOR_MDQ_CLI procedure. Read below returns the parameter lt_monitorMdq which is a UDT type as announced. The statement "insert into select MDQ_OLD * table (lt_monitorMdq);" fails, while the second insert statement works.
Is it possible to get the first statement of work?
I'm on Oracle 11 g 2.
DECLARE
lt_monitorMdq UDT_T_MONITOR_MDQ;
BEGIN
MONITOR_MDQ_CLI. Reading (TRUNC (SYSDATE),
TRUNC (SYSDATE),
NULL,
NULL,
"MILLION BTU.
lt_monitorMdq); -Note lt_monitorMdq is an OUT parameter
-This insert does not work
Insert into MDQ_OLD select * from table (lt_monitorMdq);
BECAUSE me in 1... lt_monitorMdq.count
LOOP
Dbms_output.put_line ('lt_monitorMdq: ' | .mdq_id lt_monitorMdq (i));
-This integration works
INSERT INTO MDQ_OLD (MYMDQ)
VALUES (UDT_T_MONITOR_MDQ (UDT_R_MONITOR_MDQ)
lt_monitorMdq (i) .gasday,
1,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
() UDT_T_MONITOR_MDQ_PRIM_RIGHT
() UDT_R_MONITOR_MDQ_PRIM_RIGHT
1,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
(NULL)));
END LOOP;
END;
have you tried:
INSERT INTO MDQ_OLD (myMDQ) VALUES (lt_MonditorMDq);
curiosity:
Is there a particular reason, why you have created a table with a single column of type UDT instead of:
CREATE TABLE... OF UDT_T_MONITOR_MDQ;
I can tell you from experience that using a nested table, you can easily query the data in the nested table.
MK
-
Insert into select * from table 3. -is on the agenda by the needless?
I've got an example of script, it will work for any table, so I don't bother with the full ddl.
----------------------------------------------------------------------------
create table test in select * from hotels where 1 = 2;
Insert into test select * from Hotels by city;
Select the city from the trial;
-drop table test is serving;
-----------------------------------------------------------------------------
The amazing thing is, that the city is ordered alphabetically,
but you would say it is that an operation order is irrelevant.
Any ideas on that?
This will still work?
Edited by: FourEyes on December 8, 2008 22:55
Edited by: FourEyes on 8 December 2008 22:56
Edited by: FourEyes on 8 December 2008 22:56Hello
The [SQL Oracle 10 language reference | http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9014.htm#sthref9371] manual says:
«In regards to the ORDER BY clause from the subquery in the DML_table_expression_clause, you place your order is guaranteed only for the inserted rows and only within each extension table.» Orders new lines with regard to existing lines is not guaranteed. »
-
Insert APPEND Hint in several tables
Hi all:
Let me say at the outset that I have no dataset example of post, it is just an issue where I'm hoping to get some directions to help out my own query.
I have an insert multi-table into two tables. When I use the indicator append, the plan of the explain command is no indication that the indicator is respected. But if I change the statement and perform an insert in a single table, then I see "LIVE LOAD INTO" in the plan.
I'm stumped as to how to begin troubleshooting. Does anyone have ideas on how you might tackle a problem like this?
Thanks in advance!Looks like it works right out of the box. Here is an example of using 11.2.0.2:
create table t1 (c1 number) parallel 2; create table t2 (c1 number) parallel 2; alter session enable parallel dml; explain plan for insert all into t1 (c1) values (rnd) into t2 (c1) values (rnd) ( select 1 as rnd from dual connect by level < 10000 ); SELECT * FROM TABLE(dbms_xplan.display); rollback; alter session disable parallel dml;
Here is the output of DBMS_XPLAN showing the LIVE MODE on several tables:
Plan hash value: 2997348579 ---------------------------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | TQ |IN-OUT| PQ Distrib | ---------------------------------------------------------------------------------------------------------------------------- | 0 | INSERT STATEMENT | | 1 | 3 | 2 (0)| 00:00:01 | | | | | 1 | PX COORDINATOR | | | | | | | | | | 2 | PX SEND QC (RANDOM) | :TQ10001 | | | | | Q1,01 | P->S | QC (RAND) | | 3 | MULTI-TABLE INSERT | | | | | | Q1,01 | PCWP | | | 4 | PX RECEIVE | | | | | | Q1,01 | PCWP | | | 5 | PX SEND ROUND-ROBIN | :TQ10000 | | | | | | S->P | RND-ROBIN | | 6 | VIEW | | 1 | 3 | 2 (0)| 00:00:01 | | | | |* 7 | CONNECT BY WITHOUT FILTERING| | | | | | | | | | 8 | FAST DUAL | | 1 | | 2 (0)| 00:00:01 | | | | | 9 | DIRECT LOAD INTO | T1 | | | | | Q1,01 | PCWP | | | 10 | DIRECT LOAD INTO | T2 | | | | | Q1,01 | PCWP | | ---------------------------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 7 - filter(LEVEL<10000)
Now, there are a series of restrictions on the direct expenses as soon as you start the overlay on the constraints and triggers. See the restrictions in this section: [documentation Oracle 11.2 INSERT | http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/statements_9014.htm#SQLRF01604]
NOTE: Edited to remove the sentence that PARALLEL DML has been the key. It's not as demonstrated in successive messages but still it trigger inserts in DIRECT-path on an INSERT ALL.
Published by: scatmull on August 22, 2011 12:55
Published by: scatmull on August 22, 2011 13:56
-
Read the BLOB and insert data into a table
Hi all
Let us examine below on Oracle DB 12 c:
create table xx_test3 (c blob); insert into xx_test3 (c) values (utl_raw.cast_to_raw( 'azertyuiop,qsdfghjklm,wxcvbn')); create table xx_target (col1 varchar2(50));
Can someone guide me how to read the data and insert it into the xx_target table?
Necessary result is:
select * from xx_target; COL1 -------------------------------------------------- azertyuiop qsdfghjklm wxcvbn 3 rows selected.
Thanks in advance,
Stoyanov.
insert into xx_target (col1)
with the data as)
Select utl_raw.cast_to_varchar2 (dbms_lob.substr (c, 32000, 1)) CBC
of xx_test3
)
Select regexp_substr (CBC, ' [^,] +', 1, level)
from the data
connect by level<= regexp_count(src,="" ',')="" +="">=>
-
Reboot and select proper boot device or insert boot media in selected boot device and press a key
I have an Asus UX31 of Zenbook ultrabook. It is running Windows 8, I installed it via download, is not a physical disk.
Recently, I ran Windows Update and he knew as usual, until the time of reset. It restarts, showed on the screen "install updates", but then finally started only the following error message:
"Reboot and select proper boot device or insert boot media in selected boot device and press a key.
As mentioned, I don't have a disc, my ultrabook is not a hard drive. Internal storage only that there is a 128 GB SSD. I went into the bios and check the boot settings and the SSD is correctly listed as the only option to start.
I can only assume some question that's happened with the update of windows. I'm not sure of how to proceed now? ATM, I only have a weight £1000 :/
Hello r,.
Thanks for posting your query in Microsoft Community.
By the description of the problem, I understand that you have problems starting from the computer to the desktop screen, it gives the above error message.
I imagine how it could be frustrating when things do not work as expected. I appreciate your efforts to solve this problem.
As this problem occurred after installing Windows Update, this could be the reason for the incompatible driver installed with the Windows updates.
As you have already checked the settings for starting a disc SSD set correctly, I suggest you disconnect all the external device and restart the computer, check if are able to boot to the desktop screen.
We will try the following methods and check if it helps.
Method 1: I suggest you create USB recovery media as your laptop doesn't have the DVD Rom.
If you're having problems with your PC, a recovery USB disk can help you troubleshoot and fix these problems, even if your PC does not start.
Create an installation media for Windows 8.1
http://Windows.Microsoft.com/en-us/Windows-8/create-reset-refresh-mediaMethod 2: Once you create USB recovery media, auto repair:
Follow the steps below to perform an automatic repair:
1 restart the computer, wait for the logo of the manufacturer to check the option of start menu, it will usually F12.
2. the start menu key can be different with each manufacturer. If you are unable to find the start menu button, you can consult the user manual.
3. restart the computer, when appears the logo of the manufacturer, continue to press the Boot option menu key to enter the boot menu and change the option to boot in DVD ROM.
4. Once you start your computer by using Windows 8 DVD or system repair disc, a black screen appears with the gray text "press any key to boot from CD or DVD". Press a button on any.
5. Select the exact time and the type of keyboard.
6. click on repair your computer in the lower left corner.
7. click on troubleshooting, advanced option and then click on auto repair.Hope this helps, please reply with the status of the question to get help.
-
SQL script to insert values into a table based on the type of user
Hello
I have a requirement where I need to insert (username, groupname) in a table based on the user name.
We have two types of user accounts:
(1) user name, which starts with "DV" example: "DVPATM."
regular user 2) example: 'PATM '.
If the user name begins with "DV" under instruction insert should kick in
insert into < tablename > (username, groupname) VALUES (< username > ' < groupname1 >).
otherwise below insert statement should kick in
insert into < tablename > (username, groupname) VALUES (< username > ' < groupname2 >).
I need to use SQL or stored only procedure.
Please suggest
Thanks in advance
All things being constant, you could use decode/case just for groupname by examining the first character t the user name, for example
insert into
(username, groupname) VALUES ( , (substr ( , 1, 2) the case when "DV" then else end)); Fixed edit: value for OTHERS, as noted by Frank
-
Insert data into another database with a script
Hello.
What is the best way to insert data into one database with a script
INSERT INTO BF_PRUEBASMTP.bf_mtp_agr_inscription (ain_agreementid, ain_customerid, ain_paymethodsid, ain_servicemoduleid, referencia)
SELECT AAG. AAG_AGREEMENTID, ACU. ACU_CUSTOMERID, 2, 2, ins. NUMERO_REFERENCIA
OF BF_PRUEBASMTP.bf_mtp_agr_biller ABI
JOIN IN-HOUSE
BF_PRUEBASMTP. BF_MTP_AGR_AGREEMENT AAG ON ABI. ABI_BILLERID = AAG. AAG_BILLERID
INNER JOIN 'CLIENTEUNICO. ALMUERZO" ins
ON THE AAG. AAG_AGREEMENTID = ins. CONVENIOID
INNER JOIN BF_PRUEBASMTP.bf_mtp_agr_customer ACU
ON ACU.acu_typedocumentid = ins. TIPO_DOCUMENTO
AND ACU.acu_numberid = ins. NUMERO_DOCUMENTO;
CLIENTEUNICO. INSCRIPCIONES = SELECT * DE INSCRIPCIONES - to a DIFFERENT DATABASE
Thank you very much.
2931095 wrote:
If I don't have permissions to create a database link. Is there another way to do this?
Thank you.
link to database IS the method by which an Oracle database accesses to a different database.
If you are the ADMINISTRATOR, you should have permission.
If you are not the ADMINISTRATOR, you should not have permission and need to talk to the ADMINISTRATOR that is allowed.
-
Generate the command Id and insert data into two different tables: oracle apex 5.0
I have three tables. name of the tables: PRODUCT, ORDER_HEADER, ORDER_DETAIL. I took REPORT inter ASSETS in which the VALUES from TABLE product. I need to use the trigger here, there is a TEXT ARTICLE called ORDER ID: it will generate through trigger. so whenever new order placed order id must be unique. There is a button when this button is clicked, the VALUES of REPORT must be inserted in to ORDER_HEADER , ORDER_DETAIL (in fact, I am in confusion is it even possible).
I tried to create the trigger: not work if
CREATE OR REPLACE TRIGGER "EMP_TRG1".
Before Insert on order_header
for each line
Start
If: new. Order_ID is null
then
Select lpad (demo_seq.nextval, 8, '0'): new. Order_ID order_header;
end if;
end;
SQL:
Select
apex_item. Text(1,p.PRODUCT_ID) PID.
PN.product_name,
apex_item. Text(2,p.PRODUCT_QTY) qt.
apex_item. Text(3,p.unit_price) upward,
apex_item. Text(4,p.TOTAL_AMOUNT) am
OMS_SHIP_CART_DETAIL p, pn OMS_PRODUCT
where p.product_id = pn.product_id
DA:
var arr_f01 = [];
var arr_f02 = [];
var arr_f03 = [];
var arr_f04 = [];
var arr_f05 = [];
product_id var;
unit_price var;
Var Qty;
var total_1;
() $("input[name='f01']").each
function() {}
product_id = $(this).closest('tr') .children ('td [headers = 'PID']') .text ();
unit_price = $(this).closest('tr') .children ('td [headers = "Uprice"]') .text ();
Qty = $(this).closest('tr') .children ('td [headers = "Qty"]') .text ();
total_1 = $(this). Closest ('tr'). Children ('td [headers = "total"]'). Text();
arr_f01.push ($(this).) Val());
arr_f02.push (product_id);
arr_f03.push (total_1);
arr_f04.push (unit_price);
arr_f05.push (Qty);
} );
(apex). Server.Process
"Insert a command."
, {f01: arr_f01, f02: arr_f02, f03: arr_f03, f04: arr_f04, f05: arr_f05}
}
, {dataType: "text", success: function (pData) {alert ('added product') ;}}
);
Ajax callback:
declare
l_count number;
Start
-insert into OMS_ORDER_HEADER (USER_ID, TOTAL_AMOUNT, batch, ORDER_DATE) values(:P1_USER_ID,:P42_TOTAL,'PENDING',SYSDATE);
I'm looping 1.apex_application.g_f01.count
insert into OMS_ORDER_DETAIL (PRODUCT_ID, UNIT_QTY, UNIT_PRICE, TOTAL_AMOUNT)
values (APEX_APPLICATION. G_F01 (i), APEX_APPLICATION. G_F03 (i), APEX_APPLICATION. G_F04 (i), APEX_APPLICATION. G_F05 (i));
commit;
end loop;
end;
Hi Dominique,.
I create a process page away present in your application
declare l_order_id varchar2(8); begin insert into order_header(ORDER_ID , STATUS , ORDER_DATE) values(lpad(demo_seq.nextval,8,'0') , 'Pending' , sysdate) returning ORDER_ID into l_order_id; for rec in(select ID , QTY , PRICE from product) loop Insert Into Order_Detail ( ORDER_ID , PRODUCT_ID , QTY , UNIT_PRICE) Values(l_order_id , rec.id , rec.qty , rec.price); commit; end loop; end;
Please check and let me know.
Kind regards
Jitendra
-
Insert data into the source of destinator Table
Hi all
Need to insert data in sample_table1 table xxc_source_table sample_table2
create table xxc_source_table (DESCRIPTION varchar2 (10));
Insert the table xxc_source_table values('A201.) ABC.4084.GR');
create table sample_table1 (col_1 varchar2 (10), col_2 varchar2 (10), col_3 varchar2 (10), col_4 varchar2 (10));
create table sample_table2 (col_1 varchar2 (10), col_2 varchar2 (10), col_3 varchar2 (10), col_4 varchar2 (10), moved_flag varchar2 (2));
col_1 = A201
col_2 = ABC
col_3 = 4084
col_4 = GR
Note: Insert data into the col_1, the col_3, the col_4 of the xxc_source_table sample_table1
(2) if the next (form xxc_source_table) data is exist in the sample_table2, and then set the moved_flag as Y in this column
3) xxc_source_table has 17000 lines
Thank you.
Post edited by: Rajesh123 please do not consider cross the line message
Hi Renon,
Why you don't want substr and instr? For best performance, you should go with substr and instr instead of regexp_substr. However you asked me to provide the code instead of substr and InStr. Then try the below...
INSERT ALL
IN VALUES sample_table1 (col1, col2, col3, col4)
IN sample_table2 VALUES (col1, col2, col3, col4, 'Y')
SELECT REGEXP_SUBSTR (DESCRIPTION,'[^.] +', 1, 1) col1,.
REGEXP_SUBSTR (DESCRIPTION,'[^.] +', 1, 2) col2.
REGEXP_SUBSTR (DESCRIPTION,'[^.] +' 1, 3) col3.
REGEXP_SUBSTR (DESCRIPTION,'[^.] +' 1, 4) col4
OF xxc_source_table;
Thank you
Ann
-
inserting data into a table from another table
Hello
I have a to insert a data in the other table.
My requirement is I field Date_effect_date in the departments, I would copy the details field in dept_effect_date of employees.
I used the query
Insert in the dept_effect_date of certain employees (dept_effect_date) departments;
and the result is:
SQL error: ORA-01400: cannot insert NULL into ('HR'. "'"' EMPLOYEES'."" EMPLOYEE_ID')
01400 00000 - "impossible to insert a NULL value in (%s)."
MY DB: oracle 10g XE
Sainaba
You can do this by UPDATE not INSERT.
Sudheeryekkala wrote:
Hello
I have a to insert a data in the other table.
My requirement is I field Date_effect_date in the departments, I would copy the details field in dept_effect_date of employees.
I used the query
Insert in the dept_effect_date of certain employees (dept_effect_date) departments;
and the result is:
SQL error: ORA-01400: cannot insert NULL into ('HR'. "'"' EMPLOYEES'."" EMPLOYEE_ID')
01400 00000 - "impossible to insert a NULL value in (%s)."
MY DB: oracle 10g XE
Sainaba
INSERT the results of will by adding new lines to the table so you have the above error. In your case, you must update the value of the existing column
(or, if the volume is large, then fill the data -
join the table two in a new table CREATE TABLE EMP_NEW AS SELECT * FROM EMPLOYEES, DEPARTMENTS
. fall of
; Rename emp_new to
; * constraints/indexes if necessary be supported...
)
E employees update
Set e.dept_effect_date = (select d.dept_effect_date
departments d
where e.dept_id = d.dept_id);
Concerning
Biju
-
table name not valid error when inserting values into a table
I use the following statement to insert values into a table:
curs. Execute ("INSERT INTO _ * '%s' * _ VALUES ((SELECT MAX (REC_ID) + 1 OF GSAP_MSG_IN), (SELECT MAX (gsap_msg_id) + 1 OF GSAP_MSG_IN), 'SHELLSAP', sysdate, '%s', EMPTY_BLOB(), 1, SYSDATE, EMPTY_BLOB (), SYSDATE)" %(*table_name*,file_extension)) ")
whence table_name the following statement
table_name = ' config.staging_db_tablesNames ['in_msgs]
as I created a configuration file for all parameters that can change. The value of the table in the audit using a print command is correctly, but when put in the query above to run the insert statement gives an error. The following is the summary of comprehensive performance where you can see the table name as
$ python gsapscnr.py
Vote for the data files in/home/mh/inbox /...
GSAP_MSG_IN
Traceback (most recent call changed):
File "gsapscnr.py", line 147, in it?
poll_for_data()
File "gsapscnr.py", line 86, in poll_for_data
Sorter = load_details_first)
File "gsapscnr.py", line 42, survey
curs. Execute ("INSERT INTO '%s' VALUES ((SELECT MAX (REC_ID) + 1 OF GSAP_MSG_IN), (SELECT MAX (gsap_msg_id) + 1 OF GSAP_MSG_IN), 'SHELLSAP', sysdate, '%s', EMPTY_BLOB(), 1, SYSDATE, EMPTY_BLOB (), SYSDATE)" %(table_name,file_extension)) ")
cx_Oracle.DatabaseError: ORA-00903: invalid table name
Can anyone help with this problem please. I'm passing the value of the table in a bad way. Also if anyone can suggest a good tutorial for paythong programming using cx_Oracle.
ConcerningPrint the SQL string that you establish, cut and paste it this output in SQL * more and see if it runs. This may show you that you should remove the single quotes around the name of the table %s in the Python file.
Maybe you are looking for
-
Hello IAM currently has a grade 11 student. I know the fast programming language and I'm interested in developing an ios app, but the problem is xcode works only on the computer mac laptop. I can't afford it. IAM having mac and poor financial history
-
"searching for leads", how can I get rid of him forever...
research leads' How do I get rid of him forever, seems embezzling something, he withdrew the search engine options, but it keeps reappearing, having (apparently) not isolated, the Control Panel program, but its still LURKING there somewhere
-
My Satellite C660-1UJ does not start
Hello people, My laptop Toshiba Satellite * c660-1uj starts up. It does nothing when I press the powerbutton.When I connect the poweradapter I hear a clicking sound, as it is with or without the battery and I also see the light (led) battery flashes
-
Error modem already in use or is not configured properly
Original title: try to use the modem internet cleartalk on laptop Downloaded there screen says. but when I try to connect it gives me an error that it is already in use or is not configured correctly. It is of ClearTalk EVDO Mobile Broadband
-
my photo section does not work all photos have a top cover
After tech own finished microsoft out of unnecessary files, I can't get it to work rightanything I in charge of the section of photo file has a cover on them and I have to use a viewer to see I think that the tech, removed a part of the HELP programm