Use the nologging clause
Hi, I tried to use the nologging clause to improve the performance of DML on one of the table. However I have observed this table with nologging option actually decreases performance :(Please see the next newspaper.
SQL > create table test_log (int id, name char (40))
2.
Table created.
Elapsed time: 00:00:00.03
SQL > create table test_nolog (int id, name char (40)) nologging
2.
Table created.
Elapsed time: 00:00:00.00
SQL > insert into test_log select ROWNUM *-1, DBMS_RANDOM. String('A',1) FROM DUAL CONNECT BY LEVEL < = 1000000
2.
1000000 rows created.
Elapsed time: 00:00:13.46
SQL > insert into test_nolog select ROWNUM *-1, DBMS_RANDOM. String('A',1) FROM DUAL CONNECT BY LEVEL < = 1000000
2.
1000000 rows created.
Elapsed time: 00:00:16.95
SQL > update test_log set id = 100
2.
1000000 lines to date.
Elapsed time: 00:00:46.35
SQL > update test_nolog set id = 100
2.
1000000 lines to date.
Elapsed time: 00:00:49.43
Insert and update have no impact if the tables are created with the NOLOGGING clause or logging
It generates the same amount of redo for insert and UPDATE stmts stmts
NOLOGGING can help for the following things
1 CTAS
2.SQL * loader in direct mode
3. INSERT / * + APPEND * /...
SYSTEM@rman 15/12/2008> truncate table test_log;
Table truncated.
Elapsed: 00:00:01.49
SYSTEM@rman 15/12/2008> truncate table test_nolog;
Table truncated.
Elapsed: 00:00:00.67
SYSTEM@rman 15/12/2008> insert into test_nolog select ROWNUM*-1,DBMS_RANDOM.STRING('A',1) FROM DUAL CONNECT BY LEVEL <=1000000;
1000000 rows created.
Elapsed: 00:00:39.80
Execution Plan
----------------------------------------------------------
Plan hash value: 1731520519
------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Cost (%CPU)| Time |
------------------------------------------------------------------------------
| 0 | INSERT STATEMENT | | 1 | 2 (0)| 00:00:01 |
| 1 | COUNT | | | | |
|* 2 | CONNECT BY WITHOUT FILTERING| | | | |
| 3 | FAST DUAL | | 1 | 2 (0)| 00:00:01 |
------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter(LEVEL<=1000000)
Statistics
----------------------------------------------------------
3081 recursive calls
41111 db block gets
8182 consistent gets
0 physical reads
60983504 _redo size_
674 bytes sent via SQL*Net to client
638 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
2 sorts (memory)
0 sorts (disk)
1000000 rows processed
SYSTEM@rman 15/12/2008> commit;
Commit complete.
Elapsed: 00:00:00.03
SYSTEM@rman 15/12/2008> insert into test_log select ROWNUM*-1,DBMS_RANDOM.STRING('A',1) FROM DUAL CONNECT BY LEVEL <=1000000;
1000000 rows created.
Elapsed: 00:00:38.79
Execution Plan
----------------------------------------------------------
Plan hash value: 1731520519
------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Cost (%CPU)| Time |
------------------------------------------------------------------------------
| 0 | INSERT STATEMENT | | 1 | 2 (0)| 00:00:01 |
| 1 | COUNT | | | | |
|* 2 | CONNECT BY WITHOUT FILTERING| | | | |
| 3 | FAST DUAL | | 1 | 2 (0)| 00:00:01 |
------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter(LEVEL<=1000000)
Statistics
----------------------------------------------------------
3213 recursive calls
41323 db block gets
8261 consistent gets
2 physical reads
60993120 _redo_ size
674 bytes sent via SQL*Net to client
636 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
2 sorts (memory)
0 sorts (disk)
1000000 rows processed
SYSTEM@rman 15/12/2008> commit;
They simply generate the same anount of redo
If you use hint APPEND, you can reduce the timings of INSERT stmt
SYSTEM@rman 15/12/2008> truncate table test_nolog;
Table truncated.
Elapsed: 00:00:00.28
SYSTEM@rman 15/12/2008> INSERT /*+ APPEND */ into test_nolog select ROWNUM*-1,DBMS_RANDOM.STRING('A',1) FROM DUAL CONNECT BY LEVEL <=100
1000000 rows created.
Elapsed: 00:00:28.19
Execution Plan
----------------------------------------------------------
ERROR:
ORA-12838: cannot read/modify an object after modifying it in parallel
SP2-0612: Error generating AUTOTRACE EXPLAIN report
Statistics
----------------------------------------------------------
3125 recursive calls
8198 db block gets
929 consistent gets
0 physical reads
161400 redo size
660 bytes sent via SQL*Net to client
652 bytes received via SQL*Net from client
3 SQL*Net roundtrips to/from client
2 sorts (memory)
0 sorts (disk)
1000000 rows processed
SYSTEM@rman 15/12/2008>
You can also view time significant difference/redo generated between INSERT and INSERT with append on a table NOLOGGING
Tags: Database
Similar Questions
-
I have trouble understanding the following query:
SELECT cust_city, COUNT (cust_last_name)
Customers
WHERE cust_credit_limit > 1000
GROUP BY cust_city
HAVING AVG (cust_credit_limit) BETWEEN 5000 AND 6000
According to my preparation for the review, it will work successfully without errors, although I don't understand why.
The AVG (cust_credit_limit) should also be included in with the rest of the fields to make it work correctly?
It would be greatly appreciated if someone could explain it to me better.
Thank you
Sean
5285cd35-2ff3-432e-B2FD-19285481be60 wrote:
I have trouble understanding the following query:
SELECT cust_city, COUNT (cust_last_name)
Customers
WHERE cust_credit_limit > 1000
GROUP BY cust_city
HAVING AVG (cust_credit_limit) BETWEEN 5000 AND 6000
According to my preparation for the review, it will work successfully without errors, although I don't understand why.
The AVG (cust_credit_limit) should also be included in with the rest of the fields to make it work correctly?
It would be greatly appreciated if someone could explain it to me better.
Thank you
Sean
No - the AVG function doesn't have to be in the select list. Explain why you think it should be.
How would it make a difference if you added to the SELECTION list and ignored, then?
When you have questions DOC the first thing you need to do is RTFM. See the HAVING clause in the RFSO of the SQL language
http://docs.Oracle.com/CD/B28359_01/server.111/b28286/statements_10002.htm
>
HAVING clause
Use of the
HAVING
clause to restrict groups of returns of the lines to these groups for which the specifiedcondition
isTRUE
.>
As the doc t says
He HAVING condition applies to the 'groups '.
If you use the HR. EMPLOYEES table you can see the effect of the HAVING clause. This query is similar to yours but with none HAVING clause, and the AVG (salary) added to the selection list to see which groups will have
>
Select department_id, count (last_name), avg (salary)
employees
where salary > 500
Group by department_id- DEPARTMENT_ID, COUNT (LAST_NAME), AVG (SALARY)
- 10,1,4400
- 20,2,9500
- 30,6,4150
- 40,1,6500
- 50,45,3475.55555555556
- 60,5,5760
- 70,1,10000
- 80,34,8955.88235294118
- 90,3,19333.3333333333
- 100,6,8601.33333333333
- 110,2,10154
- 1,7000
>
Note that 60 is the ONLY group with AVG (salary) between 5000 and 6000
Now, try the query using the HAVING clause
>
Select department_id, count (last_name)
employees
where salary > 500
Group by department_id
having avg (salary) between 5000 and 6000
DEPARTMENT_ID, COUNT (LAST_NAME)
60.5
>
Only group 60 has been selected - the HAVING condition has been applied to the first query GROUPS, not the lines.
-
The sql statement is
Select ename, job
from emp, dept
where emp.deptno = dep.deptno
and emp.deptno = 10
Union
Select ename, job
from emp, dept
where emp.deptno = dep.deptno
and emp.deptno = 20
the statement above using the WITH Clause
WITH dept10 AS
(select ename, job, hiredate, sal, comm, dname, emp.deptno
from emp, dept
where emp.deptno = dept.deptno
and emp.deptno = 10)
dept20 AS
(select ename, job, hiredate, sal, comm, dname, emp.deptno
from emp, dept
where emp.deptno = dept.deptno
and emp.deptno = 20)
SELECT *.
OF dept10
UNION
SELECT *.
OF dept20
Correct me if I'm wrong...
Thank youHello
SeenuGuddu wrote:
the Question is how u would provide the statement above by using the ClauseThe answer is that the question is meaningless. You will not use a WITH clause for this work.
Because you must use a WITH clause to get the same results as the first query, I think the best way would be:
WITH unnecessary_sub_query AS ( select DISTINCT ename, job -- , hiredate, sal, comm, dname,emp.deptno -- these columns are not in the original query from emp , dept where emp.deptno = dept.deptno and emp.deptno IN (10, 20) ) SELECT * FROM unnecessary_sub_query;
is this correct using Clause WITH or correct me
No, it's not ok to make queries more complex or slow they need to do.
In addition to the extra columns, it seems that the second query that you posted (the one who has a WITH clause) produces the same results as the first request. -
Cannot use the command clause contained in the posting online of a cursor
Dear people,
I use Oracle 10 g with forms 6i. I had a requirement where I gotto choose the latest ten records and view the sorting in the opposite order.say for ex.
But my problem is all the time that I came to know that we cannot use the order by clause in the view of a cursor line in forms 6i. Think it's one of the limitations of forms 6i.so u can suggest me what I can do to get the expected results? do we not have any alternative?Cursor C is select * from (select ename,sal from emp order by sal desc) where rownum<=10;
Thanking you,
Concerning
Vids
Published by: vidusnat on July 4, 2012 03:38Hello
Please specify!
Forms 6i must be with an older version of SQL and PL/SQL (8.x).To keep it simple create a VIEW in the comics with your as its source and the use of the VIEW in the form. As you noted, it works in 10g and exploit it.
See you soon,.
-
ORA-26040: data block has been loaded using the NOLOGGING option
Hello
Why option NOLOGGING is a proposed option can corrupt the data files?
You would kind of explain it to me?
Thank you.
Should you have primary level NOLOGGING operations, incremental update of the previous day.
See 9.3.6 to http://docs.oracle.com/cd/E11882_01/server.112/e41134/manage_ps.htm#SBYDB00206
and 13.4 at http://docs.oracle.com/cd/E11882_01/server.112/e41134/scenarios.htm#SBYDB00920
Hemant K Collette
-
HOW TO USE THE CONNECT_BY CLAUSE
Hi guys... I have a table like this
create table emp_del (ename varchar2 (10), mname varchar2 (10))
Insert into emp_del values ('ABC', 'MNO')
Insert into emp_del values ('MNO', 'XYZ')
Insert into emp_del values ('XYZ', 'king')
Insert into emp_del values ('king', NULL)
I use this sql to return the name of any employee senior...
SELECT SYS_CONNECT_BY_PATH (MNAME, '-->') "MANAGER_NAME".
OF EMP_DEL
CONNECT PRIOR MNAME = ENAME
START BY ENAME =: P_EMPLOYEE_NAME
ex: ename = ABC
released as: - > MNO
-> MNO-> XYZ
-> MNO-> XYZ-> King
-> MNO-> XYZ-> king - >
I just need the output to be-> King
can you guys help meOne way:
select ename from( select e.*,connect_by_isleaf lf from emp_del e connect by prior mname=ename start with ename=:P_EMPLOYEE_NAME ) where lf = 1
Note: it can be simplified as below, just used a subquery to understand...
select ename from emp_del e where connect_by_isleaf = 1 connect by prior mname=ename start with ename=:P_EMPLOYEE_NAME
-
PL/SQL parameter in fusion by using the clause
Hi all
I need to create a procedure where I use the Merge clause. However, by using the condition, I have to put value user_define (V_LOCALE_CD). This value checks table of locale and then to make a match with table of flex_labels_test.
There is no specific requirement and I don't have the test data.
My only question how do I use user set the value using the condition. Here is the procedure I created as follows.
create or replace the PROCEDURE UPSERT_FLEX_LABEL_3 (V_LOCALE_CD IN VARCHAR2,
V_VALUE IN VARCHAR2,
V_FIELDVALUE IN VARCHAR2,
V_FIELDNAME IN VARCHAR2,
V_TABLENAME IN VARCHAR2,
N_FLEX_TYPE NUMBER,
V_COLOR IN VARCHAR2 DEFAULT NULL,
N_IMAGE_LIBRARY_ID IN THE NUMBER DEFAULT NULL,
N_HIERARCHY_ID IN DEFAULT NUMBER 5237260000000000001,
N_IS_INHERITED IN THE DEFAULT NUMBER 1)
AS
L_COUNT NUMBER;
NUMBER OF N_LOCALE_ID;
NUMBER OF NN_HIERARCHY_ID: = 5237260000000000001;
NUMBER OF NN_IS_INHERITED: = 1;
NUMBER OF INSERTCOUNT;
UPDATECOUNT NUMBER;
NUMBER OF ERR_CODE;
ERR_MSG VARCHAR2 (100);
BEGIN
-SELECT ID IN N_LOCALE_ID OF PLACES WHERE LOCALE_CD = V_LOCALE_CD;
/ * IT WILL CHECK DUPLICATES, IF THEY ARE PRESENT, THEN IT WILL UPDATE RECORD ELSE IT WILL INSERT A NEW RECORD * /.
BEGIN
Merge into fl flex_labels_test
using (select locale id where locale_cd = V_LOCALE_CD) L
on (l.id = fl.locale_id)
When matched then
GAME UPDATE
HIERARCHY_ID = NVL (N_HIERARCHY_ID, NN_HIERARCHY_ID),
IS_INHERITED = NVL (N_IS_INHERITED, NN_IS_INHERITED),
FLEX_TYPE = N_FLEX_TYPE,
VALUE = V_VALUE,
IMAGE_LIBRARY_ID = N_IMAGE_LIBRARY_ID,
COLOR = V_COLOR
WHERE TABLENAME = V_TABLENAME
AND FIELDNAME = V_FIELDNAME
AND FIELDVALUE = V_FIELDVALUE
When not matched then
INSERT (HIERARCHY_ID, ID_PARAMETRES_REGIONAUX, IS_INHERITED, FLEX_TYPE, TABLENAME, FIELDNAME, FIELDVALUE, VALUE, IMAGE_LIBRARY_ID, COLOR)
VALUES (NVL (N_HIERARCHY_ID, NN_HIERARCHY_ID), N_LOCALE_ID, NVL (N_IS_INHERITED, NN_IS_INHERITED), N_FLEX_TYPE, V_TABLENAME, V_FIELDNAME, V_FIELDVALUE, V_VALUE, N_IMAGE_LIBRARY_ID, V_COLOR);
UPDATECOUNT: = NUMBER OF ROWS SQL %;
EXCEPTION
WHILE OTHERS THEN
ERR_CODE: = SQLCODE;
ERR_MSG: = SUBSTR (SQLERRM, 1, 200);
DBMS_OUTPUT. PUT_LINE ("ERRORS" |) ERR_CODE | ' AND ' | ERR_MSG);
END;
COMMIT;
DBMS_OUTPUT. PUT_LINE ('RECORD INSERTCOUNT =' |) NVL(INSERTCOUNT,0));
DBMS_OUTPUT. PUT_LINE (' UPDATECOUNT RECORD ='|) NVL(UPDATECOUNT,0));
EXCEPTION
WHEN NO_DATA_FOUND THEN
RAISE_APPLICATION_ERROR (-20001, "ID NOT FOUND REGIONAL SETTINGS");
END;
I guess that's what I was looking for. Thank you guys for your efforts.
-
Not able to connect after changing the password using the VALUES ALTER clause
Hello
John explained earlier the clause VALUES below thread.
Status expired
I created a new account named SURI, and tried to use the password of the user account from the HR by using the VALUES clause. I was able to change the password but not able to connect SURI with HR password.
Please see below for details. And the SQL statements that I have tried.
Thank youSQL*Plus: Release 10.2.0.1.0 - Production on Mon Aug 13 18:44:50 2012 Copyright (c) 1982, 2005, Oracle. All rights reserved. Enter user-name: sys as sysdba Enter password: Connected to: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production SQL> SELECT password 2 FROM dba_users 3 WHERE username = 'HR'; PASSWORD ------------------------------ 4C6D73C3E8B0F0DA SQL> ALTER USER SURI IDENTIFIED BY VALUES '4C6D73C3E8B0F0DA'; User altered. SQL> SELECT password 2 FROM dba_users 3 WHERE username='SURI'; PASSWORD ------------------------------ 4C6D73C3E8B0F0DA SQL> conn suri/hr -- HR account's password is hr only ERROR: ORA-01017: invalid username/password; logon denied Warning: You are no longer connected to ORACLE. SQL>
SuriIts because you have used a different username.
Oracle produces a hash based on the user name and the password, not only the password.Therefore, you can not use the hashed password of a user to log on to the account of another user.
You need to get the password hashed Suri and then connect you to suri by using the password hashed Suri (using the identified by the syntax of values)
-
How to use the "Order by" clause dynamically on values LOV Forms 10g r2
Hello
I have following requirement, please guide me.
1. create a list of values with 2 fields, Code and Description
2. do not use the command clause contained in the registration request Group
3. fix this LOV on a form field
4. when the user calls the user LOV will see two fields in LOV with header as Code and Description
5. when the user clicks the column header "Code" then LOV should be arranged on Code
6 and if the user clicks on the header of the column "Description" then LOV must be sorted on the Description
Thanks in advance.Please post this problem in this forum->
[Formulas Forum | http://forums.oracle.com/forums/forum.jspa?forumID=82]
And close this thread by he scored as replied. ;)
Kind regards.
LOULOU.
-
Can I use the following script should set up rman DB only or non-rman configured DB
Hello
I need your help this following script
recover database using backup controlfile until Cancel;
I can only used in configured RMAN DB.
(or)
Can we used above usual script on database (IE. RMAN not configured the database)
Please suggest me. Thanks in advance.
If you use RMAN to create backup BackupSet, you use RMAN to RESTORE the database.
Subsequently, you can use RMAN or SQLPLUS to issue the command to RECOVER the DATABASE.
(RMAN has no clause 'using backup controlfile' because it identifies the controlfile as a backup, while sqlplus must use the following clause if the controlfile is a backup)
Hemant K Collette
-
Database parameter determines the parallel clause?
Hi all
I come with a request that we can use the parallel clause in several ddl, dml statements etc, but where I got stucked was, what parameter in the database that controls or defines the parallel clause.
For example,.
What is the maximum that we can use for parallel.
Please help me in this
Search PARALLEL_MAX_SERVERS
This is the max in all concurrent sessions. If you are looking for a session limit, you will need to see if the resource manager is configured.
Hemant K Collette
-
Oracle 11 g 2 Linux x86_64
Hi all
I do turn the PL/SQL block below, but get the error below. I know, the INTO clause can be used only when a single line will be returned. In this case, I know that it returns multiple lines, so why he asked to use the INTO clause?DECLARE
v_object VARCHAR2 (10): = "TABLE";
v_schema VARCHAR2 (30): = 'TEST ';
CURSOR tblsze_cur IS
SELECT table_name
FROM dba_tables
Owner WHERE = 'TEST '.
AND (IN) table_name
"T1"
"T2."
"T3");
BEGIN
FOR tbl_rec IN tblsze_cur
LOOP
Select * from
Table (dbms_space. OBJECT_GROWTH_TREND
(v_schema, tbl_rec.table_name, v_object)) ;
END LOOP;
END;
/
Select * from table (dbms_space. OBJECT_GROWTH_TREND
*
ERROR at line 21:
ORA-06550: line 21, column 3:
PLS-00428: an INTO clause in this SELECT statement
It would be something more like this (untested)...
Set serverout on
create type object_growth_trend_row as object)
validating TIMESTAMP,
space_usage NUMBER,
space_alloc NUMBER,
quality VARCHAR (20))
/Create type object_growth_trend_table as table of the object_growth_trend_row
/DECLARE
number of r;
We varchar2 (30): = 'SCOTT ';
TYPE nmtbl IS TABLE OF THE all_tables.table_name%TYPE;
tNom nmtbl;
tgrowth object_growth_trend_table;
CURSOR c1 IS
SELECT table_name
From all_tables
Owner WHERE we =
AND table_name in ('EMP', 'Department');
growth of cursor (tablename in varchar2) is
Select *.
table (dbms_space.object_growth_trend (tablename, 'TABLE'));
BEGIN
OPEN c1;
FETCH c1 COLLECT LOOSE tNom;
CLOSE c1;
BECAUSE me IN tNom. FIRST... tNom. LAST
LOOP
r: = 0;
dbms_output.put_line (' growth for table: ' | tname (i));
FOR g IN growth (tname (i))
LOOP
r: = r + 1;
dbms_output.put_line ('Timestamp: ' | g.timePoint |') Use: ' | g.space_usage);
END LOOP;
DBMS_OUTPUT. Put_line (' found lines: ' | r);
END LOOP;
END;
/I just tested this in my SYS schema (although you should not create objects in SYS.) and got...
For table growth: EMP
EXCEPTION in the treatment of the Charles - code:-14551 msg: ORA-14551: cannot perform a DML operation inside a query
Timestamp: 3 July 13 09.15.27.250000 use: 5332
Found lines: 1
For table growth: DEPT
EXCEPTION in the treatment of the Charles - code:-14551 msg: ORA-14551: cannot perform a DML operation inside a query
Timestamp: 3 July 13 09.15.27.282000 use: 4846
Found lines: 1
Not sure why it's up the DML operation... which seems inner exception to the dbms_space package. Even if I just run it directly in sys like this:
SQL > SELECT *.
2. IN the TABLE (dbms_space.object_growth_trend ('SYS', ' $', TAB 'TABLE'));AFTER SPACE_USAGE SPACE_ALLOC QUALITY
--------------------------------------------------------------------------- ----------- ----------- --------------------
3 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
4 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
JULY 5, 13 09.19.01.956000 10342201 24117248 INTERPOLATED
6 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
7 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
8 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
9 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
10 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
JULY 11, 13 09.19.01.956000 10342201 24117248 INTERPOLATED
12 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
13 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
14 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
15 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
16 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
17 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
18 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
19 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
20 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
21 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
22 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
23 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
24 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
25 JULY 13 09.19.01.956000 10342201 24117248 INTERPOLATED
26 JULY 13 09.19.01.956000 10342201 24117248 GOOD
27 JULY 13 09.19.01.956000 10342201 24117248 GOOD
28 JULY 13 09.19.01.956000 10342201 24117248 GOOD
29 JULY 13 09.19.01.956000 10342201 24117248 GOOD
30 JULY 13 09.19.01.956000 10342201 24117248 GOOD
31 JULY 13 09.19.01.956000 10342201 24117248 GOOD
1ST AUGUST 13 09.19.01.956000 10342201 24117248 GOOD
2 AUGUST 13 09.19.01.956000 10342201 24117248 GOOD
3 AUGUST 13 09.19.01.956000 10342201 24117248 PLANNED
4 AUGUST 13 09.19.01.956000 10342201 24117248 PLANNED
5 AUGUST 13 09.19.01.956000 10342201 24117248 PLANNED
6 AUGUST 13 09.19.01.956000 10342201 24117248 PLANNED
7 AUGUST 13 09.19.01.956000 10342201 24117248 PLANNED36 selected lines.
EXCEPTION in the treatment of the Charles - code:-14551 msg: ORA-14551: cannot perform a DML operation inside a query
... She still throws the exception.
Doesn't seem like a package of well designed if the types are provided only in the package and not as objects of database, which are required to be used in SQL based in pipeline.
-
Errors during insertion and update form using the VIEW.
Here is my opinion:
CREATE OR REPLACE FORCE VIEW "SH_ADD_EMPLOYEES_VW" ("EMP_ID", "DEPT_ID", "JOB_DESC_ID", "EMPNO", "EMP_FIRST", "EMP_LAST", "USER_NAME", "USER_INI", "DEPTNO", "DEPT_DESC", "ROLES_ID", "ADMIN", "CREATES", "APPROVES", "QUALITY", "CUST_SVC", "SH_LOCAL", "SH_OFFICE", "SYSTEM") AS select "SH_EMPLOYEES"."EMP_ID" as "EMP_ID", "SH_EMPLOYEES"."DEPT_ID" as "DEPT_ID", "SH_EMPLOYEES"."JOB_DESC_ID" as "JOB_DESC_ID", "SH_EMPLOYEES"."EMPNO" as "EMPNO", "SH_EMPLOYEES"."EMP_FIRST" as "EMP_FIRST", "SH_EMPLOYEES"."EMP_LAST" as "EMP_LAST", "SH_EMPLOYEES"."USER_NAME" as "USER_NAME", "SH_EMPLOYEES"."USER_INI" as "USER_INI", "SH_EMPLOYEES"."DEPTNO" as "DEPTNO", "SH_EMPLOYEES"."DEPT_DESC" as "DEPT_DESC", "DOC_ROLES"."ROLES_ID" as "ROLES_ID", "DOC_ROLES"."ADMIN" as "ADMIN", "DOC_ROLES"."CREATES" as "CREATES", "DOC_ROLES"."APPROVES" as "APPROVES", "DOC_ROLES"."QUALITY" as "QUALITY", "DOC_ROLES"."CUST_SVC" as "CUST_SVC", "DOC_ROLES"."SH_LOCAL" as "SH_LOCAL", "DOC_ROLES"."SH_OFFICE" as "SH_OFFICE", "DOC_ROLES"."SYSTEM" as "SYSTEM" FROM "SH_EMPLOYEES" "SH_EMPLOYEES", "DOC_ROLES" "DOC_ROLES" where "SH_EMPLOYEES"."EMP_ID" = "DOC_ROLES"."EMP_ID" /
Here's my trigger (note - I do not use the EXCEPTION clause or (declaration of it) because it throws an error msg = >: 'This is my message'.) Here, any help would be great as well.)
CREATE OR REPLACE TRIGGER bi_ADD_EMPLOYEES_VW INSTEAD OF insert ON SH_ADD_EMPLOYEES_vw for each row declare duplicate_info EXCEPTION; PRAGMA EXCEPTION_INIT(duplicate_info, -00001); begin insert into SH_EMPLOYEES (EMP_ID, DEPT_ID, JOB_DESC_ID, EMPNO, EMP_FIRST, EMP_LAST, USER_NAME, USER_INI, DEPTNO, DEPT_DESC) values (:new.EMP_ID, :new.DEPT_ID, :new.JOB_DESC_ID, :new.EMPNO, :new.EMP_FIRST, :new.EMP_LAST, :new.USER_NAME, :new.USER_INI, :new.DEPTNO, :new.DEPT_DESC); insert into DOC_ROLES (ROLES_ID, ADMIN, CREATES, APPROVES, QUALITY, CUST_SVC, SH_LOCAL, SH_OFFICE, SYSTEM) VALUES ( :new.ROLES_ID, :new.ADMIN, :new.CREATES, :new.APPROVES, :new.QUALITY, :new.CUST_SVC, :new.SH_LOCAL, :new.SH_OFFICE, :new.SYSTEM); EXCEPTION WHEN duplicate_info THEN RAISE_APPLICATION_ERROR ( num=> -20107 msg=> 'Duplicate employee'); END bi_ADD_EMPLOYEES_VW; /
ERROR ON UPDATE:
ORA-20505: DML error: p_rowid = 1001,.
p_alt_rowid = EMP_ID, p_rowid2 = 2, p_alt_rowid2 = ROLES_ID. ORA-01779: cannot change
a column that is mapped to a table not preserved keyERROR WHEN INSERTING:
ORA-01400: cannot insert NULL in
("SPICE_HUNTER1". "" "" SH_EMPLOYEES '. "" EMP_ID") ORA-06512: at
"SPICE_HUNTER1. BI_SH_ADD_EMPLOYEES_VW', line 3 ORA-04088: error during execution
relaxing ' SPICE_HUNTER1. BI_SH_ADD_EMPLOYEES_VW' ORA-06512: at
'SYS. WWV_DBMS_SQL', line 549 ORA-06512: at "APEX_040000.WWV_FLOW_DML", line 1121
ORA-22816: feature not supported with RETURNING clauseError Impossible to process line on table SH_ADD_EMPLOYEES_VW
I see you manage emp_id is null, you must assign a value if null sequence... This column cannot be null, where the error, and "Edit" a column of this table the DML to this id value.
-
Formula using the following string...
Hi all
Given a set of strings that can is be parsed (see format below), possible to do a TWG
a set of such strings - i.e. the chain may have the form (from
another thread (pricing using the string formula)) the chain is a bulk
dicount "record" for a product - product code not included for now.
I want to use SQL exclusively, but am open to suggestions - examples
using WITH are especially welcome - has spent time last night, a truck load
rising WITH (of no use, it must be added ;))
_100 (20) 90 (50) 80_ String format
See the code below*-20 first purchased items cost 100,.
the cost of the next 50 90 and all the foregoing is 80/unit.
What I would like is to be able to build a 'table' that I can join real Oracle
tables - imagine these "records" of the chain are coming thick and fast and for reasons x, y
or z, prices can be written to a permanent table. A product code must be
included, but I think fundamental analysis once did, adding such a code should not
be a problem.
So, if I have a set of these strings, how build a TWG?
If it is the right approach.
Any ideas, references, URL - be it, much appreciated.
What would be really cool is if the code could take a product with an arbitrary
number of discounts - 2, some 3 (that is, for example), 4... & c...
TIA
Paul...
Code-Cerca Trova of another thread
My own efforts (did not know that Cerca Trova had done) - even if it's rubbish, at leastwith t as( select '100(20)90(50)80' str from dual ) select regexp_replace(regexp_substr(str,'\)\d*',1,2),'\)|\(','')from t -- 80 --select regexp_replace(regexp_substr(str,'\d*(\)|\()',1,1),'\)|\(','')from t -- 100 --select regexp_replace(regexp_substr(str,'\d*(\)|\()',1,2),'\)|\(','')from t -- 20 --select regexp_replace(regexp_substr(str,'\d*(\)|\()',1,3),'\)|\(','')from t -- 90 --select regexp_replace(regexp_substr(str,'\d*(\)|\()',1,4),'\)|\(','')from t -- 50
I tried ;)
Below retrieves the number 20 - sample - allows to extract all the numbersWITH StrTab AS -- *returns 100* = Price1 ( SELECT '100(20)90(50)80' iStr FROM Dual ) SELECT( TO_NUMBER(SUBSTR(iStr, 1, INSTR(iStr, '(', 1, 1) -1)) ) AS "Price1" FROM StrTab;
Published by: Paulie 9 may 2012 12:32SELECT -- *returns 20* = Quantity 1 TO_NUMBER( SUBSTR('100(20)90(50)80', (INSTR('100(20)90(50)80', '(', 1, 1) + 1) , (INSTR('100(20)90(50)80', ')', 1, 1) - (INSTR('100(20)90(50)80', '(', 1, 1) + 1)))) AS "Quantity1" FROM Dual;
Published by: Paulie 9 may 2012 12:36Hello
Whenever you have a problem, please post a CREATE TABLE and INSERT statements for a small example of data like this:
CREATE TABLE table_x ( id NUMBER (6) PRIMARY KEY , txt VARCHAR2 (30) ) ; INSERT INTO table_x (id, txt) VALUES (0, NULL); INSERT INTO table_x (id, txt) VALUES (1, '75'); INSERT INTO table_x (id, txt) VALUES (2, '100(10)80'); INSERT INTO table_x (id, txt) VALUES (3, '100(20)90(50)80'); COMMIT;
In addition, to say what version of Oracle you are using. The query below work Oracle 10.1 and higher:
WITH cntr AS ( SELECT LEVEL AS n FROM dual CONNECT BY LEVEL <= 5 -- worst case ) , rates AS ( SELECT x.id , x.txt , c.n , TO_NUMBER ( REGEXP_SUBSTR ( '0)' || x.txt , '[^()]+' , 1 , (2 * c.n) - 1 ) ) AS start_qty , TO_NUMBER ( REGEXP_SUBSTR ( x.txt , '[^()]+' , 1 , (2 * c.n) - 1 ) ) AS rate FROM table_x x JOIN cntr c ON c.n <= LENGTH (txt) + 1 - LENGTH (REPLACE (txt, '(')) ) SELECT * FROM rates ORDER BY id , n ;
Output:
` ID TXT N START_QTY RATE ---------- ------------------------------ ---------- ---------- ---------- 1 75 1 0 75 2 100(10)80 1 0 100 2 100(10)80 2 10 80 3 100(20)90(50)80 1 0 100 3 100(20)90(50)80 2 20 90 3 100(20)90(50)80 3 50 80
If you use the WITH clauses above in any question, you can use rates in table form in the following parts of the query.
This assumes you know an upper limit for the number of items in the string. I took 5 different rates above, but you can easily change that to any fixed number. You can also derive the exact number of data themselves. I'll leave that as an exercise.
You can use the analytical function of LEAD to add another column, end_qty, rates.
Published by: Frank Kulash, 9 may 2012 10:24
It also means that txt is well-formed. A space before or after the parentheses is probably correct, but in additional brackets, letters, several decimal places or sign in the same 'number' and things like that will cause all errors.START_QTY is a misleading name; I should have used something like LOW_QTY or PREV_QTY. In the example above, the row with id = 3 and start_qty = 20 applies in reality to the amount above 20, i.e. 21 to 50 inclusively (since 50 is START_QTY for this id).
-
How to eliminate the union clause
I have a requirement where I need to get some recording (say 5 records) of the table and the sum (TOTAL) of some columns in these 5 folders that should be displayed as the last record. Im trying it work with union all clause
Select cd
pid
dt
number
type
sum (iamt) iamt
sum (ALMPs) ALMPs
sum (oamt) oamt
idt
from t1
where code = 'NAQ.
Group by cd, pid, dt, idt
Union of all the
Select 'TOTAL '.
null
null
null
null
sum (iamt) iamt
sum (ALMPs) ALMPs
sum (oamt) oamt
null
from t1
where code = 'NAQ;
is there a way I can avoid using the UNION clause and achieve the same...? Kindly share your thoughts...Hello
Try below:
SELECT cd,
nest,
DT,
NUMBER,
TYPE,
Sum (iAMT) iamt,
Sum (ALMPS) ALMPs,
Sum (OAMT) oamt,
IDT
FROM t1
WHERE code = 'NAQ.
GROUP BY GROUPING SETS ((dt, cd, pid, NUMBER, idt), NULL)Kind regards
Karine
Maybe you are looking for
-
Cannot open safari on iPad message of invalid address
ON iPad mind iOS 9.3.2,and trying to open the live stream on ITV, message from safari "cannot be opened due to an invalid address.
-
Based reading Serial and example of writing used in a graph
Reading and writing labview example I get responses like '250 v' and "v 3000". How to make just the "250" and "3000", as the right type of data, put in a table or a chart? All opinions are appreciated. Thank you!
-
HP Pavilion g6-1304sv Notebook: RAM upgrade
Hello, again! This time, I would like to ask a question about RAM. I have this laptop... HP Pavilion g6-1304sv Notebook... and I want to add some memory to my 4 GB I have already. My laptop is a RAM like this... AData 4 GB 1333 MHz PC3-10600. So my q
-
my computer dell laptop with windows vista does not recognize the battery what should I do?
I have a computer dell laptop which will not recognize the battery what should I do?
-
BlackBerry Smartphones block a phone number
I have a bcurve for blackberry 8300 series. Does anyone know if it is possible to block calls and text from a specific number?