Require DML and DDL for basic tables

Hello,
I want to pursue my oracle certification within 2-3 months. Therefore, I am eager to create basic tables those would provide me holistic idea and basic practices before my real test. Could you provide me basic tables for example, employee table, department table, sales table etc.with DML and DDL details? I do create plethora of DB objects when I build systems for clients; however, additionally, I intend to practice concepts whatever I will acquire after going through oracle books before certification.
Thanks!

Here is the sample script i took it from HR & SH Schemas.
host echo Building Oracle demonstration tables. Please wait.
set termout off
DROP TABLE EMP;
DROP TABLE DEPT;
DROP TABLE BONUS;
DROP TABLE SALGRADE;
DROP TABLE DUMMY;
DROP TABLE ITEM;
DROP TABLE PRICE;
DROP TABLE PRODUCT;
DROP TABLE ORD;
DROP TABLE CUSTOMER;
DROP VIEW SALES;
DROP SEQUENCE ORDID;
DROP SEQUENCE CUSTID;
DROP SEQUENCE PRODID;
CREATE TABLE DEPT (
DEPTNO NUMBER(2) NOT NULL,
DNAME VARCHAR2(14),
LOC VARCHAR2(13),
CONSTRAINT DEPT_PRIMARY_KEY PRIMARY KEY (DEPTNO));
INSERT INTO DEPT VALUES (10,'ACCOUNTING','NEW YORK');
INSERT INTO DEPT VALUES (20,'RESEARCH','DALLAS');
INSERT INTO DEPT VALUES (30,'SALES','CHICAGO');
INSERT INTO DEPT VALUES (40,'OPERATIONS','BOSTON');
CREATE TABLE EMP (
EMPNO NUMBER(4) NOT NULL,
ENAME VARCHAR2(10),
JOB VARCHAR2(9),
MGR NUMBER(4) CONSTRAINT EMP_SELF_KEY REFERENCES EMP (EMPNO),
HIREDATE DATE,
SAL NUMBER(7,2),
COMM NUMBER(7,2),
DEPTNO NUMBER(2) NOT NULL,
CONSTRAINT EMP_FOREIGN_KEY FOREIGN KEY (DEPTNO) REFERENCES DEPT (DEPTNO),
CONSTRAINT EMP_PRIMARY_KEY PRIMARY KEY (EMPNO));
INSERT INTO EMP VALUES (7839,'KING','PRESIDENT',NULL,'17-NOV-81',5000,NULL,10);
INSERT INTO EMP VALUES (7698,'BLAKE','MANAGER',7839,'1-MAY-81',2850,NULL,30);
INSERT INTO EMP VALUES (7782,'CLARK','MANAGER',7839,'9-JUN-81',2450,NULL,10);
INSERT INTO EMP VALUES (7566,'JONES','MANAGER',7839,'2-APR-81',2975,NULL,20);
INSERT INTO EMP VALUES (7654,'MARTIN','SALESMAN',7698,'28-SEP-81',1250,1400,30);
INSERT INTO EMP VALUES (7499,'ALLEN','SALESMAN',7698,'20-FEB-81',1600,300,30);
INSERT INTO EMP VALUES (7844,'TURNER','SALESMAN',7698,'8-SEP-81',1500,0,30);
INSERT INTO EMP VALUES (7900,'JAMES','CLERK',7698,'3-DEC-81',950,NULL,30);
INSERT INTO EMP VALUES (7521,'WARD','SALESMAN',7698,'22-FEB-81',1250,500,30);
INSERT INTO EMP VALUES (7902,'FORD','ANALYST',7566,'3-DEC-81',3000,NULL,20);
INSERT INTO EMP VALUES (7369,'SMITH','CLERK',7902,'17-DEC-80',800,NULL,20);
INSERT INTO EMP VALUES (7788,'SCOTT','ANALYST',7566,'09-DEC-82',3000,NULL,20);
INSERT INTO EMP VALUES (7876,'ADAMS','CLERK',7788,'12-JAN-83',1100,NULL,20);
INSERT INTO EMP VALUES (7934,'MILLER','CLERK',7782,'23-JAN-82',1300,NULL,10);
CREATE TABLE BONUS (
ENAME VARCHAR2(10),
JOB CHAR(9),
SAL NUMBER,
COMM NUMBER);
CREATE TABLE SALGRADE (
GRADE NUMBER,
LOSAL NUMBER,
HISAL NUMBER);
INSERT INTO SALGRADE VALUES (1,700,1200);
INSERT INTO SALGRADE VALUES (2,1201,1400);
INSERT INTO SALGRADE VALUES (3,1401,2000);
INSERT INTO SALGRADE VALUES (4,2001,3000);
INSERT INTO SALGRADE VALUES (5,3001,9999);
CREATE TABLE DUMMY (
DUMMY NUMBER );
INSERT INTO DUMMY VALUES (0);
CREATE TABLE CUSTOMER (
CUSTID NUMBER (6) NOT NULL,
NAME VARCHAR2(45),
ADDRESS VARCHAR2(40),
CITY VARCHAR2(30),
STATE VARCHAR2(2),
ZIP VARCHAR2(9),
AREA NUMBER (3),
PHONE VARCHAR2(9),
REPID NUMBER (4) NOT NULL,
CREDITLIMIT NUMBER (9,2),
COMMENTS LONG,
CONSTRAINT CUSTOMER_PRIMARY_KEY PRIMARY KEY (CUSTID),
CONSTRAINT CUSTID_ZERO CHECK (CUSTID > 0));
CREATE TABLE ORD (
ORDID NUMBER (4) NOT NULL,
ORDERDATE DATE,
COMMPLAN VARCHAR2(1),
CUSTID NUMBER (6) NOT NULL,
SHIPDATE DATE,
TOTAL NUMBER (8,2) CONSTRAINT TOTAL_ZERO CHECK (TOTAL >= 0),
CONSTRAINT ORD_FOREIGN_KEY FOREIGN KEY (CUSTID) REFERENCES CUSTOMER (CUSTID),
CONSTRAINT ORD_PRIMARY_KEY PRIMARY KEY (ORDID));
CREATE TABLE ITEM (
ORDID NUMBER (4) NOT NULL,
ITEMID NUMBER (4) NOT NULL,
PRODID NUMBER (6),
ACTUALPRICE NUMBER (8,2),
QTY NUMBER (8),
ITEMTOT NUMBER (8,2),
CONSTRAINT ITEM_FOREIGN_KEY FOREIGN KEY (ORDID) REFERENCES ORD (ORDID),
CONSTRAINT ITEM_PRIMARY_KEY PRIMARY KEY (ORDID,ITEMID));
CREATE TABLE PRODUCT (
PRODID NUMBER (6) CONSTRAINT PRODUCT_PRIMARY_KEY PRIMARY KEY,
DESCRIP VARCHAR2(30));
CREATE TABLE PRICE (
PRODID NUMBER (6) NOT NULL,
STDPRICE NUMBER (8,2),
MINPRICE NUMBER (8,2),
STARTDATE DATE,
ENDDATE DATE);
INSERT INTO CUSTOMER (ZIP, STATE, REPID, PHONE, NAME, CUSTID, CREDITLIMIT,
CITY, AREA, ADDRESS, COMMENTS)
VALUES ('96711', 'CA', '7844', '598-6609',
'JOCKSPORTS',
'100', '5000', 'BELMONT', '415', '345 VIEWRIDGE',
'Very friendly people to work with -- sales rep likes to be called Mike.');
INSERT INTO CUSTOMER (ZIP, STATE, REPID, PHONE, NAME, CUSTID, CREDITLIMIT,
CITY, AREA, ADDRESS, COMMENTS)
VALUES ('94061', 'CA', '7521', '368-1223',
'TKB SPORT SHOP',
'101', '10000', 'REDWOOD CITY', '415', '490 BOLI RD.',
'Rep called 5/8 about change in order - contact shipping.');
INSERT INTO CUSTOMER (ZIP, STATE, REPID, PHONE, NAME, CUSTID, CREDITLIMIT,
CITY, AREA, ADDRESS, COMMENTS)
VALUES ('95133', 'CA', '7654', '644-3341',
'VOLLYRITE',
'102', '7000', 'BURLINGAME', '415', '9722 HAMILTON',
'Company doing heavy promotion beginning 10/89. Prepare for large orders during
winter.');
INSERT INTO CUSTOMER (ZIP, STATE, REPID, PHONE, NAME, CUSTID, CREDITLIMIT,
CITY, AREA, ADDRESS, COMMENTS)
VALUES ('97544', 'CA', '7521', '677-9312',
'JUST TENNIS',
'103', '3000', 'BURLINGAME', '415', 'HILLVIEW MALL',
'Contact rep about new line of tennis rackets.');
INSERT INTO CUSTOMER (ZIP, STATE, REPID, PHONE, NAME, CUSTID, CREDITLIMIT,
CITY, AREA, ADDRESS, COMMENTS)
VALUES ('93301', 'CA', '7499', '996-2323',
'EVERY MOUNTAIN',
'104', '10000', 'CUPERTINO', '408', '574 SURRY RD.',
'Customer with high market share (23%) due to aggressive advertising.');
INSERT INTO CUSTOMER (ZIP, STATE, REPID, PHONE, NAME, CUSTID, CREDITLIMIT,
CITY, AREA, ADDRESS, COMMENTS)
VALUES ('91003', 'CA', '7844', '376-9966',
'K + T SPORTS',
'105', '5000', 'SANTA CLARA', '408', '3476 EL PASEO',
'Tends to order large amounts of merchandise at once. Accounting is considering
raising their credit limit. Usually pays on time.');
INSERT INTO CUSTOMER (ZIP, STATE, REPID, PHONE, NAME, CUSTID, CREDITLIMIT,
CITY, AREA, ADDRESS, COMMENTS)
VALUES ('94301', 'CA', '7521', '364-9777',
'SHAPE UP',
'106', '6000', 'PALO ALTO', '415', '908 SEQUOIA',
'Support intensive. Orders small amounts (< 800) of merchandise at a time.');
INSERT INTO CUSTOMER (ZIP, STATE, REPID, PHONE, NAME, CUSTID, CREDITLIMIT,
CITY, AREA, ADDRESS, COMMENTS)
VALUES ('93301', 'CA', '7499', '967-4398',
'WOMENS SPORTS',
'107', '10000', 'SUNNYVALE', '408', 'VALCO VILLAGE',
'First sporting goods store geared exclusively towards women. Unusual promotion
al style and very willing to take chances towards new products!');
INSERT INTO CUSTOMER (ZIP, STATE, REPID, PHONE, NAME, CUSTID, CREDITLIMIT,
CITY, AREA, ADDRESS, COMMENTS)
VALUES ('55649', 'MN', '7844', '566-9123',
'NORTH WOODS HEALTH AND FITNESS SUPPLY CENTER',
'108', '8000', 'HIBBING', '612', '98 LONE PINE WAY', '');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN)
VALUES ('101.4', '08-JAN-87', '610', '07-JAN-87', '101', 'A');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN)
VALUES ('45', '11-JAN-87', '611', '11-JAN-87', '102', 'B');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN)
VALUES ('5860', '20-JAN-87', '612', '15-JAN-87', '104', 'C');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN)
VALUES ('2.4', '30-MAY-86', '601', '01-MAY-86', '106', 'A');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN)
VALUES ('56', '20-JUN-86', '602', '05-JUN-86', '102', 'B');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN)
VALUES ('698', '30-JUN-86', '604', '15-JUN-86', '106', 'A');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN)
VALUES ('8324', '30-JUL-86', '605', '14-JUL-86', '106', 'A');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN)
VALUES ('3.4', '30-JUL-86', '606', '14-JUL-86', '100', 'A');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN)
VALUES ('97.5', '15-AUG-86', '609', '01-AUG-86', '100', 'B');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN)
VALUES ('5.6', '18-JUL-86', '607', '18-JUL-86', '104', 'C');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN)
VALUES ('35.2', '25-JUL-86', '608', '25-JUL-86', '104', 'C');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN)
VALUES ('224', '05-JUN-86', '603', '05-JUN-86', '102', '');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN)
VALUES ('4450', '12-MAR-87', '620', '12-MAR-87', '100', '');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN)
VALUES ('6400', '01-FEB-87', '613', '01-FEB-87', '108', '');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN)
VALUES ('23940', '05-FEB-87', '614', '01-FEB-87', '102', '');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN)
VALUES ('764', '10-FEB-87', '616', '03-FEB-87', '103', '');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN)
VALUES ('1260', '04-FEB-87', '619', '22-FEB-87', '104', '');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN)
VALUES ('46370', '03-MAR-87', '617', '05-FEB-87', '105', '');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN)
VALUES ('710', '06-FEB-87', '615', '01-FEB-87', '107', '');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN)
VALUES ('3510.5', '06-MAR-87', '618', '15-FEB-87', '102', 'A');
INSERT INTO ORD (TOTAL, SHIPDATE, ORDID, ORDERDATE, CUSTID, COMMPLAN)
VALUES ('730', '01-JAN-87', '621', '15-MAR-87', '100', 'A');
INSERT INTO ITEM (QTY, PRODID, ORDID, ITEMTOT, ITEMID, ACTUALPRICE)
VALUES ('1', '100890', '610', '58', '3', '58');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ( '1', '100861', '611', '45', '1', '45');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ( '100', '100860', '612', '3000', '1', '30');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ( '1', '200376', '601', '2.4', '1', '2.4');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ( '20', '100870', '602', '56', '1', '2.8');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ( '3', '100890', '604', '174', '1', '58');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ( '2', '100861', '604', '84', '2', '42');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ( '10', '100860', '604', '440', '3', '44');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ( '4', '100860', '603', '224', '2', '56');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ( '1', '100860', '610', '35', '1', '35');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ( '3', '100870', '610', '8.4', '2', '2.8');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ( '200', '200376', '613', '440', '4', '2.2');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ( '444', '100860', '614', '15540', '1', '35');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ( '1000', '100870', '614', '2800', '2', '2.8');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ( '20', '100861', '612', '810', '2', '40.5');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('150', '101863', '612', '1500', '3', '10');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('10', '100860', '620', '350', '1', '35');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('1000', '200376', '620', '2400', '2', '2.4');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('500', '102130', '620', '1700', '3', '3.4');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ( '100', '100871', '613', '560', '1', '5.6');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('200', '101860', '613', '4800', '2', '24');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('150', '200380', '613', '600', '3', '4');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('100', '102130', '619', '340', '3', '3.4');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('50', '100860', '617', '1750', '1', '35');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('100', '100861', '617', '4500', '2', '45');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('1000', '100871', '614', '5600', '3', '5.6');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('10', '100861', '616', '450', '1', '45');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('50', '100870', '616', '140', '2', '2.8');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('2', '100890', '616', '116', '3', '58');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('10', '102130', '616', '34', '4', '3.4');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('10', '200376' , '616', '24', '5', '2.4');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('100', '200380', '619', '400', '1', '4');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('100', '200376', '619', '240', '2', '2.4');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('4', '100861', '615', '180', '1', '45');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('1', '100871', '607', '5.6', '1', '5.6');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('100', '100870', '615', '280', '2', '2.8');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('500', '100870', '617', '1400', '3', '2.8');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('500', '100871', '617', '2800', '4', '5.6');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('500', '100890', '617', '29000', '5', '58');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('100', '101860', '617', '2400', '6', '24');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('200', '101863', '617', '2500', '7', '12.5');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('100', '102130', '617', '340', '8', '3.4');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('200', '200376', '617', '480', '9', '2.4');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('300', '200380', '617', '1200', '10', '4');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('5', '100870', '609', '12.5', '2', '2.5');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('1', '100890', '609', '50', '3', '50');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('23', '100860', '618', '805', '1', '35');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('50', '100861', '618', '2255.5', '2', '45.11');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('10', '100870', '618', '450', '3', '45');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('10', '100861', '621', '450', '1', '45');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('100', '100870', '621', '280', '2', '2.8');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('50', '100871', '615', '250', '3', '5');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('1', '101860', '608', '24', '1', '24');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('2', '100871', '608', '11.2', '2', '5.6');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('1', '100861', '609', '35', '1', '35');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('1', '102130', '606', '3.4', '1', '3.4');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('100', '100861', '605', '4500', '1', '45');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('500', '100870', '605', '1400', '2', '2.8');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('5', '100890', '605', '290', '3', '58');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('50', '101860', '605', '1200', '4', '24');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('100', '101863', '605', '900', '5', '9');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('10', '102130', '605', '34', '6', '3.4');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('100', '100871', '612', '550', '4', '5.5');
INSERT INTO ITEM ( QTY , PRODID , ORDID , ITEMTOT , ITEMID , ACTUALPRICE)
VALUES ('50', '100871', '619', '280', '4', '5.6');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('4.8', '01-JAN-85', '100871', '3.2', '01-DEC-85');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('58', '01-JAN-85', '100890', '46.4', '');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('54', '01-JUN-84', '100890', '40.5', '31-MAY-84');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('35', '01-JUN-86', '100860', '28', '');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('32', '01-JAN-86', '100860', '25.6', '31-MAY-86');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('30', '01-JAN-85', '100860', '24', '31-DEC-85');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('45', '01-JUN-86', '100861', '36', '');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('42', '01-JAN-86', '100861', '33.6', '31-MAY-86');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('39', '01-JAN-85', '100861', '31.2', '31-DEC-85');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('2.8', '01-JAN-86', '100870', '2.4', '');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('2.4', '01-JAN-85', '100870', '1.9', '01-DEC-85');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('5.6', '01-JAN-86', '100871', '4.8', '');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('24', '15-FEB-85', '101860', '18', '');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('12.5', '15-FEB-85', '101863', '9.4', '');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('3.4', '18-AUG-85', '102130', '2.8', '');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('2.4', '15-NOV-86', '200376', '1.75', '');
INSERT INTO PRICE (STDPRICE, STARTDATE, PRODID, MINPRICE, ENDDATE)
VALUES ('4', '15-NOV-86', '200380', '3.2', '');
CREATE INDEX PRICE_INDEX ON PRICE(PRODID, STARTDATE);
INSERT INTO PRODUCT (PRODID, DESCRIP)
VALUES ('100860', 'ACE TENNIS RACKET I');
INSERT INTO PRODUCT (PRODID, DESCRIP)
VALUES ('100861', 'ACE TENNIS RACKET II');
INSERT INTO PRODUCT (PRODID, DESCRIP)
VALUES ('100870', 'ACE TENNIS BALLS-3 PACK');
INSERT INTO PRODUCT (PRODID, DESCRIP)
VALUES ('100871', 'ACE TENNIS BALLS-6 PACK');
INSERT INTO PRODUCT (PRODID, DESCRIP)
VALUES ('100890', 'ACE TENNIS NET');
INSERT INTO PRODUCT (PRODID, DESCRIP)
VALUES ('101860', 'SP TENNIS RACKET');
INSERT INTO PRODUCT (PRODID, DESCRIP)
VALUES ('101863', 'SP JUNIOR RACKET');
INSERT INTO PRODUCT (PRODID, DESCRIP)
VALUES ('102130', 'RH: "GUIDE TO TENNIS"');
INSERT INTO PRODUCT (PRODID, DESCRIP)
VALUES ('200376', 'SB ENERGY BAR-6 PACK');
INSERT INTO PRODUCT (PRODID, DESCRIP)
VALUES ('200380', 'SB VITA SNACK-6 PACK');
CREATE SEQUENCE ORDID
INCREMENT BY 1
START WITH 622
NOCACHE;
CREATE SEQUENCE PRODID
INCREMENT BY 1
START WITH 200381
NOCACHE;
CREATE SEQUENCE CUSTID
INCREMENT BY 1
START WITH 109
NOCACHE;
CREATE VIEW SALES AS
SELECT REPID, ORD.CUSTID, CUSTOMER.NAME CUSTNAME, PRODUCT.PRODID,
DESCRIP PRODNAME, SUM(ITEMTOT) AMOUNT
FROM ORD, ITEM, CUSTOMER, PRODUCT
WHERE ORD.ORDID = ITEM.ORDID
AND ORD.CUSTID = CUSTOMER.CUSTID
AND ITEM.PRODID = PRODUCT.PRODID
GROUP BY REPID, ORD.CUSTID, NAME, PRODUCT.PRODID, DESCRIP;

Similar Messages

  • Rerunning script (DML and DDL) without ora-00001 and ora-00955 errors

    What is the best way to write a DML and DDL script so that it can be run multiple times without these ORA errors:
    ORA-00955: name is already used by an existing object
    ORA-00001: unique constraint (JILL.SYS_C00160247) violated
    I have just joined a product development company using SQL Server as there primary database. They have just completed a port to Oracle.
    Their product release upgrades (given to clients) include sql scripts with database changes (structure and data). They require that the client be able to rerun the scripts more than once with no errors. In SQL Server, the accomplish it this way.
    For DDL:
    if not exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MyTab]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
    Begin
         CREATE TABLE [dbo].[MyTab] (
              [ID]int IDENTITY(1,1),
              [InvID] uniqueidentifier not null
    For DML:
    IF NOT EXISTS (SELECT 1 FROM [dbo].[mytab] WHERE [Name] = 'Smith' and [ID] = 3)
    BEGIN
    INSERT INTO [dbo].[mytab]
    ([ID] ,[Name]
    VALUES (3,'Smith')
    END
    I am tasked with duplicating this logic on the Oracle side. The only way I can think of so far is using plsql and checking for existence before every insert and create statement. The other options I thought of cannot be used in this case
    - "whenever sqlerror continue" - gives the same response for all errors. True errors should stop the code, so this is too risky.
    - "log errors into ... reject limit unlimited" on the insert - I thought this was my best solution until I found out that it doesn't support lobs.
    Do you know of any more elegant (and more efficient) solution other than plsql cursors to check for existence before running each insert/create?
    Any suggestions would be greatly appreciated.

    select table_name from user_tables will give you the table exist or not.
    all_tables/dba_tables
    http://download.oracle.com/docs/cd/B14117_01/server.101/b10755/statviews_1190.htm#i1592091

  • Trigger to audit DML and DDL nor working

    Requirement: Application team complains that everyday within a fixed timeframe, 1 entry from a particular table is being deleted. They are unable to track it, which particular job is it doing it.
    DBA: We had 3 solutions: 1. AUDIT_TRAIL
    2. FGA
    3. Customized TRIGGER to track the DML and DDL.
    After discussion, option 3 has been implemented. Here is the code.
    DML Trigger
    =======
    CREATE OR REPLACE TRIGGER SLCPROD.STORE_TERM_ID_HST_TRG
    BEFORE INSERT OR UPDATE OR DELETE
    ON SLCPROD.STORE_TERM_ID FOR EACH ROW
    BEGIN
    IF UPDATING THEN
    INSERT INTO STORE_TERM_ID_HIST
    ( STR_NUM,
    TERM_ID,
    HOST_ENV,
    USR_TERMINAL,
    SESSION_USR,
    OS_USER,
    ACTION_DATE,
    ACTION_NAME)
    VALUES
    ( TRUNC(:OLD.STR_NUM)||','||:NEW.STR_NUM,
    TRUNC(:OLD.TERM_ID)||','||:NEW.TERM_ID,
    sys_context('USERENV', 'HOST'),
    sys_context('USERENV', 'TERMINAL'),
    sys_context('USERENV', 'SESSION_USER'),
    sys_context('USERENV', 'OS_USER'),
    SYSDATE,
    'UPDATE');
    ELSIF DELETING THEN
    INSERT INTO STORE_TERM_ID_HIST
    ( STR_NUM,
    TERM_ID,
    HOST_ENV,
    USR_TERMINAL,
    SESSION_USR,
    OS_USER,
    ACTION_DATE,
    ACTION_NAME)
    VALUES
    ( :OLD.STR_NUM,
    :OLD.TERM_ID,
    sys_context('USERENV', 'HOST'),
    sys_context('USERENV', 'TERMINAL'),
    sys_context('USERENV', 'SESSION_USER'),
    sys_context('USERENV', 'OS_USER'),
    SYSDATE,
    'DELETE');
    END IF;
    END;
    DDL Trigger
    ========
    CREATE OR REPLACE TRIGGER SLCPROD.STORE_TERM_ID_HST_TRG_TRUNC
    AFTER DDL ON DATABASE
    declare
    object_name varchar2(30);
    BEGIN
    select distinct ora_dict_obj_name into object_name from dual;
    if UPPER(object_name)= 'STORE_TERM_ID'
    then
    INSERT INTO STORE_TERM_ID_HIST
    ( STR_NUM,
    TERM_ID,
    HOST_ENV,
    USR_TERMINAL,
    SESSION_USR,
    OS_USER,
    ACTION_DATE,
    ACTION_NAME)
    VALUES
    ( 'NA',
    'NA',
    sys_context('USERENV', 'HOST'),
    sys_context('USERENV', 'TERMINAL'),
    sys_context('USERENV', 'SESSION_USER'),
    sys_context('USERENV', 'OS_USER'),
    SYSDATE,
    ora_sysevent);
    END IF;
    END;
    TABLE STORE_TERM_ID_HIST DESC
    =======================
    Name Null? Type
    STR_NUM CHAR(25)
    TERM_ID CHAR(25)
    HOST_ENV VARCHAR2(50)
    USR_TERMINAL VARCHAR2(50)
    SESSION_USR VARCHAR2(50)
    OS_USER VARCHAR2(50)
    ACTION_DATE DATE
    ACTION_NAME VARCHAR2(50)
    Though we have these triggers in place, still we can see that 1 record is getting deleted (do not know how as I haven't been able to track it) between 8 AM - 8:50 AM. We have verified it from COUNT and also know which particular record is getting deleted.
    We tried to see if any error logged due to these triggers in ALERT logs, but no error specific to it has been seen. We have tested the TRIGGERs using manuals queries, and they seem to be working fine.
    Could anyone please help what could be happening here? Or any better solution of resolving it.
    Thanks,
    Tapan
    Edited by: TapanKumar Saha on Mar 31, 2013 10:04 PM
    updated the code.

    Thank you all for all the help.
    My issue is resolved now. Here is the analysis:
    Our triggers (both for DML and DDL) were working earlier as well. However, it was not capturing the actions. We could see that last_ddl_date is being updated with the time when we are expecting the mischievous to happen. So, after having internal discussions, we concluded that "ALTER INDEX.." could also update the last_ddl_date. But it has nothing to do with the DELETE. However, to track the INDEX DDLs we added trigger on INDEX as well. Here is the modified code:
    DDL Trigger
    =======
    CREATE OR REPLACE TRIGGER SLCPROD.STORE_TERM_ID_HST_TRG_TRUNC
    AFTER DDL ON DATABASE
    declare
    object_name varchar2(30);
    BEGIN
    select distinct ora_dict_obj_name into object_name from dual;
    if UPPER(object_name)= 'STORE_TERM_ID'
    then
    INSERT INTO STORE_TERM_ID_HIST
    ( STR_NUM,
    TERM_ID,
    HOST_ENV,
    USR_TERMINAL,
    SESSION_USR,
    OS_USER,
    ACTION_DATE,
    ACTION_NAME)
    VALUES
    ( 'NA',
    'NA',
    sys_context('USERENV', 'HOST'),
    sys_context('USERENV', 'TERMINAL'),
    sys_context('USERENV', 'SESSION_USER'),
    sys_context('USERENV', 'OS_USER'),
    SYSDATE,
    ora_sysevent);
    elsif UPPER(object_name)= 'STORE_TERM_ID_PK'
    then
    INSERT INTO STORE_TERM_ID_HIST
    +( STR_NUM,+
    TERM_ID,
    HOST_ENV,
    USR_TERMINAL,
    SESSION_USR,
    OS_USER,
    ACTION_DATE,
    ACTION_NAME)
    VALUES
    +( 'NA',+
    +'NA',+
    sys_context('USERENV', 'HOST'),
    sys_context('USERENV', 'TERMINAL'),
    sys_context('USERENV', 'SESSION_USER'),
    sys_context('USERENV', 'OS_USER'),
    SYSDATE,
    ora_sysevent);
    END IF;
    END;
    It started tracking the TRUNCATE on the table.
    Also, we we increased the length of the data types for the temporary table to avoid any insertion errors. And finally put an INSERT trigger after seeing TRUNCATE DDLs. And we thus we resolved the issue.

  • Extract DDL for Partitioned tables in Oracle 8i

    Hi
    I am currently working on an Oracle 8i database. I have a need to extract the DDL of the existing tables & indexes. Dont need a schema level DDL extract, i just need it for a couple of tables and the corresponding indexes. I am currently using PL/SQL Developer a third party tool which is okay for extracting DDL for Non Partitioned tables, but when it comes to getting the DDL for PARTITIONED tables, it doesnt give me the partition information nor the tablespace information. We dont have a license for Toad or any other tools to get the DDL's. I also dont have the export/import privs on the DB. I need a free ware that can give me the DDL for the existing partitioned tables or atleast a query that I can run against the regular DBA views, which can give me the DDL along with Storage clause, the tablespace, indexes, grants & constraints.
    Thanks in Advance
    Chandra

    I also dont have the export/import privs on the DB. I need a
    free ware that can give me the DDL for the existing
    partitioned tables or atleast a query that I can run
    against the regular DBA views, which can give me the
    DDL along with Storage clause, the tablespace,
    indexes, grants & constraints.But you (or the owner or the tables you connect with) should have export/import privs on its on tables (i.e the two tables). So use the User Views instead of DBA Views.
    USER_TABLES, USER_TAB_PARTITIONS etc

  • Required Help and Documentations for following Scenarios. URGENT

    Hi every one,
    I require help and materials for following scenarios:
    <b>1) RFC to IDOC
    2) JDBC to RFC & IDOC
    3) Mail to File
    4) HTTP to RFC, JDBC & IDOC
    5)WEB SERVICES to RFC & IDOC
    6) IDOC to ABAP proxy
    7) Java Proxy to JDBC</b>
    my email id: <u>[email protected]</u>
    urgent plzz  help me...
    Message was edited by:
            satish c

    Satish,
    I would suggest to go through sravyas weblogs where she has given all the links to all the scenarios:
    /people/sravya.talanki2/blog/2006/12/25/aspirant-to-learn-sap-xiyou-won-the-jackpot-if-you-read-this-part-i
    /people/sravya.talanki2/blog/2006/12/26/aspirant-to-learn-sap-xiyou-won-the-jackpot-if-you-read-this-part-ii
    /people/sravya.talanki2/blog/2006/12/27/aspirant-to-learn-sap-xiyou-won-the-jackpot-if-you-read-this-part-iii
    Also check this weblogs which they have explained with some scenarios:
    Following are the links to weblogs which will help to develop the basic scenarios.
    /people/prateek.shah/blog/2005/06/08/introduction-to-idoc-xi-file-scenario-and-complete-walk-through-for-starters - IDoc to File
    /people/ravikumar.allampallam/blog/2005/03/14/abap-proxies-in-xiclient-proxy - ABAP Proxy to File
    /people/sap.user72/blog/2005/06/01/file-to-jdbc-adapter-using-sap-xi-30 - File to JDBC
    /people/prateek.shah/blog/2005/06/14/file-to-r3-via-abap-proxy - File to ABAP Proxy
    /people/venkat.donela/blog/2005/03/02/introduction-to-simplefile-xi-filescenario-and-complete-walk-through-for-starterspart1 - File to File Part 1
    /people/venkat.donela/blog/2005/03/03/introduction-to-simple-file-xi-filescenario-and-complete-walk-through-for-starterspart2 - File to File Part 2
    /people/ravikumar.allampallam/blog/2005/06/24/convert-any-flat-file-to-any-idoc-java-mapping - Any flat file to any Idoc
    /people/arpit.seth/blog/2005/06/27/rfc-scenario-using-bpm--starter-kit - File to RFC
    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1685 [original link is broken] [original link is broken] [original link is broken] [original link is broken] - File to Mail
    /people/jayakrishnan.nair/blog/2005/06/20/dynamic-file-name-using-xi-30-sp12-part--i - Dynamic File Name Part 1
    /people/jayakrishnan.nair/blog/2005/06/28/dynamic-file-namexslt-mapping-with-java-enhancement-using-xi-30-sp12-part-ii - Dynamic File Name Part 2
    /people/michal.krawczyk2/blog/2005/03/07/mail-adapter-xi--how-to-implement-dynamic-mail-address - Dynamic Mail Address
    /people/siva.maranani/blog/2005/05/25/understanding-message-flow-in-xi - Message Flow in XI
    /people/krishna.moorthyp/blog/2005/06/09/walkthrough-with-bpm - Walk through BPM
    /people/siva.maranani/blog/2005/05/22/schedule-your-bpm - Schedule BPM
    /people/sriram.vasudevan3/blog/2005/01/11/demonstrating-use-of-synchronous-asynchronous-bridge-to-integrate-synchronous-and-asynchronous-systems-using-ccbpm-in-sap-xi - Use of Synch - Asynch bridge in ccBPM
    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1403 [original link is broken] [original link is broken] [original link is broken] [original link is broken] - Use of Synch - Asynch bridge in ccBPM
    /people/michal.krawczyk2/blog/2005/08/22/xi-maintain-rfc-destinations-centrally - Maintain RFC destination centrally
    /people/sravya.talanki2/blog/2005/08/18/triggering-e-mails-to-shared-folders-of-sap-is-u - Triggering Email from folder
    /people/sravya.talanki2/blog/2005/08/17/outbound-idocs--work-around-using-party - Handling different partners for IDoc
    /people/siva.maranani/blog/2005/08/27/modeling-integration-scenario146s-in-xi - Modeling Integration Scenario in XI
    /people/michal.krawczyk2/blog/2005/08/25/xi-sending-a-message-without-the-use-of-an-adapter-not-possible - Testing of integration process
    /people/michal.krawczyk2/blog/2005/05/25/xi-how-to-add-authorizations-to-repository-objects - Authorization in XI
    http://help.sap.com/saphelp_nw04/helpdata/en/58/d22940cbf2195de10000000a1550b0/content.htm - Authorization in XI
    /people/michal.krawczyk2/blog/2005/09/09/xi-alerts--step-by-step - Alert Configuration
    /people/michal.krawczyk2/blog/2005/09/09/xi-alerts--troubleshooting-guide - Trouble shoot alert config
    /people/sameer.shadab/blog/2005/09/21/executing-unix-shell-script-using-operating-system-command-in-xi - Call UNIX Shell Script
    /people/sravya.talanki2/blog/2005/11/02/overview-of-transition-from-dev-to-qa-in-xi - Transport in XI
    /people/r.eijpe/blog/2005/11/04/using-abap-xslt-extensions-for-xi-mapping - Using ABAP XSLT Extensions for XI Mapping
    /people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure - Mail Adaptor options
    /people/pooja.pandey/blog/2005/07/27/idocs-multiple-types-collection-in-bpm - Collection of IDoc to Single File
    /people/sap.user72/blog/2005/11/17/xi-controlling-access-to-sensitive-interfaces - Controlling access to Sensitive Interfaces
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14 - The same filename from a sender to a receiver file adapter - SP14
    /people/prasad.illapani/blog/2005/11/14/payload-based-message-search-in-xi30-using-trex-engine - Payload Based Message Search in XI30 using Trex Engine /people/sap.user72/blog/2005/11/24/xi-configuring-ccms-monitoring-for-xi-part-i - XI : Configuring CCMS Monitoring for XI- Part I
    /people/michal.krawczyk2/blog/2005/11/23/xi-html-e-mails-from-the-receiver-mail-adapter - XI: HTML e-mails from the receiver mail adapter
    /people/sap.user72/blog/2005/11/22/xi-faqs-provided-by-sap-updated - XI : FAQ's Provided by SAP
    Regards,
    ---Satish

  • Audit All DML and DDL on an Application Schema

    Hello;
    I have a requirement to audit all DML and DDL on an Application Schema (Lets say SCOTT). I have set:
    ALTER SYSTEM SET audit_trail = XML, EXTENDED scope=spfile; -- Want my audit log on the OS with Bind and SQL.
    ALTER SYSTEM SET AUDIT_SYS_OPERATIONS = TRUE scope=spfile; -- Want to audit sysdba and sysoper activity
    audit create session; -- Want to see both logins and failed logins
    How would I get all DML and DDL on an Application Schema (SCOTT)?
    I am using 11iR1 Standard Edition.

    Have look at system_privilege_map and find all the options you need to audit...
    or you can use the below script..
    SELECT 'audit ' ||LOWER(name) || ' by app_user;'
    FROM system_privilege_map;
    if you want to filter-out the one you have already audited, then use dba_priv_audit_opts ...
    Hope this info will be useful to you...
    Thanks,

  • DDL for any table

    Hallo,, all
    i want to set DDL for 2 table and other table not have DDL,
    How to use DDL parameter in extract group..?
    Thanks,
    Riyas

    Yes, i was used that..
    how to use 1 table include DDL and many table exclude DDL..
    DDL INCLUDE MAPPED OBJNAME <schema>.<table2>
    or
    DDL INCLUDE MAPPED OBJNAME <schema>.<table2> , EXCLUDE OBJNAME <schema>.<table2>
    this params not work..:(
    thanks,
    Riyas

  • Creation of sequence and trigger for each table!!!!!!!1

    Hi
    I am new to trigger and Sequence field. In one of my database we have many tables with fields for specifing ID numbers. Iam planning to insert the ID field with help of a Sequence and trigger...that trigger fires by adding the sequence value from the dual table. Now the point is here we r having around *60* table with ID field. And i am planning use the above process for each table by creating sequences and trigger for each table.
    Will this affects the performance of database.
    Is there any other option other than the above process, I mean other than creating sequences and trigger for each table.
    PLzz help to resolve this issuee......
    Shiyas
    Edited by: user13170361 on Jun 7, 2010 12:37 AM

    Tiger, I didn't mind about your comment, but the point is try to use
    select NVL(max(a) + 1,1) into i from p1_temp;This line in your trigger code and see what is happening. The problem is with your trigger. You are using group by function and you will not get no_data_found !
    For more help, this is some modification of your code.
    SQL> create table p1_temp (a number(10) primary key, b number(10));
    Table created.
    SQL> create or replace trigger trg_p1_temp
      2  before insert on p1_temp for each row
      3  declare
      4  i number(10);
      5  begin
      6  begin
      7  select NVL(max(a) + 1,1) into i from p1_temp;
      8  exception
      9  when no_data_found then
    10  i := 1;
    11  end;
    12  :new.a := i;
    13  end;
    14  /
    Trigger created.
    SQL> insert into p1_temp(b) values (1);
    1 row created.
    SQL> insert into p1_temp(b) values (2);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from p1_temp;
             A          B
             1          1
             2          2
    SQL> Edited by: Saubhik on Jun 7, 2010 2:30 AM

  • "RUNSTATS and REORGCHK for single table" in DB13

    Hello,
    Our system is ECC 6.0, SAP_BASIS is SAPKB70011.
    "RUNSTATS and REORGCHK for single table" in DB13, I found the parameter, "Parallel Jobs".
    Why there is this parameter? Can we execute parallel runstats for single table in SAP environment?
    Thank you very much and best regards,
    Takae.

    Hi Takae,
    Although this DB13 job is named '.. for single table' it can process more than 1 table if you use wildcards. And only in this case parallelism makes sense, because the job cannot parallelize the runstats for one table but only parallelizes the runstats execution for different tables. Technically this is done be creating further background jobs in the SAP system.
    Best regards
    Ralf

  • How to find block free space  and PCTUSED FOR THE TABLE

    HI all,
    Due to performance issues for my database , my management ask me to reset the PCTUSED and PCTFREE values , and my doubt is
    1)How to find the current PCTUSED and PCTFREE values.
    2)How to find block free space and PCTUSED FOR THE TABLE.
    Please help me out regarding this.
    Regards,
    Vamsi.

    1)version is 10.2.0.4
    2)output of query
    tablespace extent_management allocation_type segment_space_management
    SYSTEM     LOCAL     SYSTEM     MANUAL
    UNDOTBS1     LOCAL     SYSTEM     MANUAL
    SYSAUX     LOCAL     SYSTEM     AUTO
    TEMP     LOCAL     UNIFORM     MANUAL
    USERS     LOCAL     SYSTEM     AUTO
    UNDOTBS2     LOCAL     SYSTEM     MANUAL
    INS     LOCAL     SYSTEM     AUTO
    CONFTBS     LOCAL     SYSTEM     AUTO
    REINS     LOCAL     SYSTEM     AUTO
    ANALYST     LOCAL     SYSTEM     AUTO
    BI     LOCAL     SYSTEM     AUTO
    INTRFC     LOCAL     SYSTEM     AUTO
    COGNOS     LOCAL     SYSTEM     AUTO
    TS_INDX     LOCAL     SYSTEM     AUTO
    TS_CHOLAWEB     LOCAL     SYSTEM     AUTO
    TS_DASBOARD     LOCAL     SYSTEM     AUTO

  • Log Miner is finding DDL for "new" tables, but also DML for "older" tables.

    oracle 10.2.0.5.0 Standard Edition
    (at some point in the past it was "downgraded" from enterprise edition).
    It's making me crazy,  i create a table then insert/update rows.  Log miner only shows me the create.
    However, if i do insert/update on an "older" table,  i see the DML.  The tables are in the same tablespace, both logging, and the database is forcing logging.
    I'm out of ideas, and input would be appreciated.
    thanks!
    ####### CREATE THE ORACLE.LOGMNR1 TABLE ########
    SQL> create table ORACLE.LOGMNR1
      2  (col1 varchar2(100));
    Table created.
    ####### INSERT  ROW AND UPDATE A ROW IN ORACLE.LOGMNR1 TABLE ########
    SQL> insert into ORACLE.LOGMNR1 values ('testing insert');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> update ORACLE.LOGMNR1 set col1 = 'TESTING UPDATE';
    1 row updated.
    SQL> commit;
    Commit complete.
    ####### INSERT 2 ROWS INTO AN OLD TABLE EPACS.COLUMN_COUNTS  ########
    SQL> insert into epacs.column_counts
      2  values ('TEST1',99,'TEST2',88,SYSDATE);
    1 row created.
    insert into epacs.column_counts
       values('TEST3',77,'TEST4',66,SYSDATE);
    1 row created.
    SQL> COMMIT;
    Commit complete.
    ####### INSERT ANOTHER ROW INTO ORACLE.LOGMNR1 TABLE ########
    SQL> insert into LOGMNR1 values ('ONE MORE TEST');
    1 row created.
    SQL> COMMIT;
    Commit complete.
    ####### CREATE THE ORACLE.LOGMNRAFTER TABLE ########
    SQL> CREATE TABLE LOGMNRAFTER (COL1 VARCHAR2(100));
    Table created.
    ####### INSERT A ROW INTO ORACLE.LOGMNRAFTER TABLE ########
    SQL> INSERT INTO LOGMNRAFTER VALUES('FINISHED');
    1 row created.
    SQL> COMMIT;
    Commit complete.
    ####### MINE THE LOGS FOR ACTIVITY ########
    SQL> edit
    Wrote file afiedt.buf
      1  select to_char(timestamp,'yyyy/mm/dd hh24:mi:ss'), username,
      2          operation, sql_redo
      3          from v$logmnr_contents
      4      where
      5      seg_owner in( 'ORACLE','EPACS')
      6  and
      7      operation <> 'UNSUPPORTED'  
      8*          order by timestamp
    SQL> /
    ####### IT FINDS THECREATE THE ORACLE.LOGMNR1 TABLE, BUT NO INSERTS ########
    2013/10/09 14:02:05 ORACLE                                                     
    DDL                                                                            
    create table LOGMNR1                                                           
    (col1 varchar2(100));                                                          
    ####### IT DOES FIND INSERTS FOR THE OLD EPACS.COLUMN_COUNTS TABLE ########                                                   
    2013/10/09 14:03:54 ORACLE                                                     
    INSERT                                                                         
    insert into "EPACS"."COLUMN_COUNTS"("TABLE_NM","TABLE_ROW_QTY","COLUMN_NM","COLU
    MN_QTY","LAST_UPDATE") values ('TEST1','99','TEST2','88','09-OCT-13');         
    2013/10/09 14:05:09 ORACLE                                                     
    INSERT                                                                         
    insert into "EPACS"."COLUMN_COUNTS"("TABLE_NM","TABLE_ROW_QTY","COLUMN_NM","COLU
    MN_QTY","LAST_UPDATE") values ('TEST3','77','TEST4','66','09-OCT-13');         
    ####### AND IT FIND THE CREATE FOR THE ORACLE.LOGMNRAFTER TABLE ########                                                      
    2013/10/09 14:06:11 ORACLE                                                     
    DDL                                                                            
    CREATE TABLE LOGMNRAFTER (COL1 VARCHAR2(100));                                 
    ###### BOTH TABLES ARE "LOGGING" AND LIVE IN THE SAME TABLESPACE ######
    ###### LOGGING IS FORCED AT THE DATABASE LEVEL ####
    SQL> select force_logging from v$database;
    YES                                                                            
    SQL> select owner,table_name,logging
      2  from dba_tables where owner in ('EPACS','ORACLE')
      3  and table_name in('COLUMN_COUNTS','LOGMNR1');
    EPACS                          COLUMN_COUNTS                  YES              
    ORACLE                         LOGMNR1                        YES              
    SQL> SPOOL OFF

    Nither the table showing only DDL nor the table showing DML have supplemental logging.
    thanks.
    select count(*) from ALL_LOG_GROUPS
       where LOG_GROUP_TYPE='ALL COLUMN LOGGING' and OWNER='ORACLE' and table_name='LMTEST1'
    SQL> /
      COUNT(*)
             0
        select count(*) from ALL_LOG_GROUPS
       where LOG_GROUP_TYPE='ALL COLUMN LOGGING' and OWNER='EPACS' and table_name='COLUMN_COUNTS'
      COUNT(*)
             0
    Message was edited by: user12156890
    apparently this is an issue with the database configuration and not log miner.  I ran the same test against the prodcution database and got both the DDL and DML.  I used exactly the same test script including the logminer "setup" , obviously changing the name of the log files and the name of a directory.

  • DML Error Logging for underlying tables autocreated for dimensions

    Hi,
    I have problems with logging errors during mapping for underlying tables that are automatically generated for creating dimensions. I know that DML Error Logging is supposed to work only on tables, views and materialized views, and I have tried it out using a pure table in a mapping without any reference to a dimension and specifying the error table name for it. This works perfectly. The error rows were captured correctly in the error table and the correct rows were also loaded successfully to the target table.
    However when it comes to mapping to a dimension, I have some issues with that. I specified the shadowtable name for the underlying table(right clicking on the table in design center and then choosing configure), and after deploying I did check that the error table/shadow table and also the target table were indeed created in the database.
    The problem lies now in the mapping because I am actually mapping to a dimension and not the underlying table the dimension references to. It seems that the mapping did not manage to capture details of the error table for the underlying table that the dimension was referencing to and thus were unable to capture the errors. Only the corrected rows get loaded and there were no error messages during the loading that suggests that the incorrect rows were detected.
    Would appreciate some assistance here.
    Thanks!
    WY

    Hi
    The DML error logging feature in 10gR2 and 11gR1 was restricted purely to tables, so the dimension operator did not support it. This is now supported in OWB 11gR2 (plus there is the orphan management functionality).
    Cheers
    David

  • IUUC_REPL_CONTENT - How to apply filters and replicate for Cluster tables BSEG/CDPOS

    Hello Friends,
    I have replicated the transparent tables by applying filters in IUUC_REPL_CONTENT but I know it's different for Cluster tables.
    Does anyone replicated the BSEG or CDPOS ?
    I need some inputs on this folks.
    Thanks in advance.
    Regards
    Raja

    May be this is helpful - http://scn.sap.com/community/replication-server/blog/2014/02/25/how-to-filter-on-the-initial-load-parallelize-replication

  • How to import DDL for multiple tables referencing each other?

    Hello people,
    I'm having a non-trivial problem. I need to copy a few tables from one machine to another, both 10g. Just DDL, data copying is not necessary. When I export the DDL to an SQL file using Oracle SQL Developer, the resulting file is refused at the import (again, SQL Developer). The problem is that every table references some other table(s), so every single "create table" command is refused, because the needed table is has not been created yet. What's the best solution to be applied here?
    Maybe I can draw a parallel to adding packages in Debian. When you have two packages, A and B, and they depend on each other, you cannot install them using "dpkg -i A && dpkg -i B" nor the other way around. Both calls to the dpkg will fail, due to the missing respective package. However, installing them in one command ("dpkg -i A B") is the right way. This is EXACTLY what I'd love to do with Oracle. Tell it to wait a bit, to make sure that ALL of the necessary tables are specified, and then create them virtually at once. Can it be achieved with transaction management?
    Thanks a lot for any help.

    Use exp/imp or expdb / impdp
    They will only enable constraints after all tables are imported.

  • Calling nested function to perform DML and wait for commit

    Hi everybody,
    I would like to do some DML -- an insert statement, to be specific -- in a function and have the function then return the numeric key of the newly added row. I call this function from another context and woud then be able to use the newly added data to do some stuff.
    More specifically, what I am going to do is this: I have a graph consisting of source, destination and distance triplets in a table. A user should now be able to
    1.) add a node 'A' to the graph,
    2.) add a node 'B' to the graph
    3.) get the shortest path from A to B through the graph.
    I have an inner function function INSERT_NEW_NODE(node_in in sdo_geometry, graph_in in integer) return integer
    is 
    pragma autonomous_transaction;
    cursor node_cur is 
      select
          source,
          source_geom
      from graph 
    cursor edge_cur is
        select
            source,
            destination,
            distance,
            edge_geom
        from
          graph
        where
          sdo_geom.relate(edge_geom, 'anyinteract', node_in, .005) = 'TRUE';
    begin
      -- check if identical with any existing node
      for node_rec in node_cur loop 
        if sdo_geom.relate(node_rec.source_geom, 'EQUAL', node_in, .005) = 'EQUAL' then
          return node_rec.source;
        end if;
      end loop;   
      -- get edges
      for edge_rec in edge_cur loop
         -- new_node-->edge.destination and vice versa
        insert into
          graph
            ID,
            GRAPH,
            SOURCE,
            DESTINATION,
            DISTANCE,
            SOURCE_GEOM,
            DESTINATION_GEOM,
            EDGE_GEOM
        values
          graph_id_seq.nextval, --id
          graph_in, --graph
          morton(node_in.sdo_point.x, node_in.sdo_point.y),  -- source morton key
          edge_rec.source, -- destination morton key
          sdo_geom.sdo_distance(edge_rec.source_geom_marl2000, node_in, .005, 'unit=M'), -- distance
          node_in, -- source geom
          edge_rec.source_geom,  -- dest geom
          split_line(edge_rec.edge_geom_marl2000, node_in).segment1 -- edge geom
        commit;
        --new_node-->edge.source and vice versa
        insert into
          gl_graph
            ID,
            GRAPH,
            SOURCE,
            DESTINATION,
            DISTANCE,
            SOURCE_GEOM,
            DESTINATION_GEOM,
            EDGE_GEOM
        values
          graph_id_seq.nextval, --id
          graph_in, --graph
          edge_rec.source, -- source morton key
          morton(node_in.sdo_point.x, node_in.sdo_point.y), -- destination morton key
          sdo_geom.sdo_distance(edge_rec.source_geom, node_in, .005, 'unit=M'), -- distance
          edge_rec.source_geom,  -- source geom
          node_in, -- dest geom
          split_line(edge_rec.edge_geom, node_in).segment2 -- edge geom
        commit;
      end loop
      return(morton(node_in.sdo_point.x, node_in.sdo_point.y));
    end insert_new_node;, which adds the new nodes to the graph, connects, calculates distances etc. and returns a handle to the newly added node. I call this function twice from another, outer function function get_path (line_in in sdo_geometry, graph_in in integer) return sdo_geometry
    is 
    source number;
    destination number;
    source_geom mdsys.sdo_geometry;
    destination_geom mdsys.sdo_geometry;
    begin
      source := insert_new_node(get_firstvertex(line_in), graph_in);
      destination := insert_new_node(get_lastvertex(line_in), graph_in);
      -- source := insert_new_node(get_firstvertex(line_in), graph_in);
      -- destination := insert_new_node(get_lastvertex(line_in), graph_in);
      return(get_path_geom(source, destination)); --returns a geometry which is the shortest path between source and destination
    end get_path;; and I think, I have to use automous transaction in the inner function, so that the outer function can see any change performed by the inner one. However, this only works, when I call the inner function twice (i.e. remove the comment signs in front of the last two lines of code right before the return statement in the outer function.
    So here's my questions: 1.) Why do I have to call the function twice to see the transaction complete? and 2.) How can I avoid that? Is there a way to wait with the execution of the return statement in the inner function until the insert is committed and can be seen by the outer function?
    Cheers!

    Tanks, everybody, for your replies! Let me go through them one by one
    smon asked: if you remove the pragma statement, does it work then?No, it does not, at least not, if I call the function from the outer function. In this case the insert statements in the inner function are not committed.
    If I call the inner function like thisDECLARE
      NODE_IN SDO_GEOMETRY;
      GRAPH_IN NUMBER;
      v_Return NUMBER;
    BEGIN
      NODE_IN := MDSYS.SDO_GEOMETRY(2001,<srid>,MDSYS.SDO_POINT_TYPE(<x>,<y>,<z>),NULL,NULL);
      GRAPH_IN := 3;
      v_Return := INSERT_NEW_NODE(
        NODE_IN => NODE_IN,
        GRAPH_IN => GRAPH_IN
    DBMS_OUTPUT.PUT_LINE('v_Return = ' || v_Return);
      :v_Return := v_Return;
    END;, it works without autonomous transaction, but then again like this I do not use the handle to access the newly inserted data immediately to perform some other task with it.
    sb92075 said:COMMIT inside LOOP is sub-optimal implementation (increases elapsed time) & can result in ORA-01555 error.Thanks, that was very helpful; I changed my code to commit outside of the loop, just before the return statement and it performs a lot faster now.
    user1983440, regarding my statement I think, I have to use automous transaction in the inner function, so that the outer function can see any change performed by the inner one. asked: Are you certain that this is true? No, anything but certain. I should have said "It +seems+, I have to use autonomous transaction". I wish it would work without autonomous transaction, I think it actually should and I wonder why it does not. However, if I do not use autonomous transaction, the outer function seems to try to access the data that I have inserted in the inner function before it is committed, throws a no-data-found-exception, hence a rollback is performed.
    davidp 2 said:The outer function will see whatever the inner function has done, without commit or autonomous transaction [...] In PL/SQL, the default commit is COMMIT WRITE NOWAIT, which I think does mean the transaction might not be instantly visible to the outside transaction, because the call returns before the commit really finishes. Yes, that is my notion, too. However, without autonomous transaction the inner function completes without error, then the outer uses the handles returned by the inner function to call the function <font face="courier">get_path_geom()</font> which cannot find the handles in the graph-table which raises an exception and causes a rollback.
    Let me summarize: The inner function completes fine, without and with autonomous transaction and returns the handle. The inner function commits, if called directly, without and (of course) with autonomous transaction. The outer function does not see the data inserted by the inner function immediately, whether without or with autonomous transaction. If I let the outer function call the inner function twice (4 times, to be specific, but twice for each newly inserted row) from the outer function and do not use autonomous transaction, I get a no-data-found exception. If I let the outer function call the inner function twice and do use autonomous transaction, it works.
    I agree with everything that was said about not using autonomous transaction in this case and I still want to solve this the right way. Any ideas are welcome!

Maybe you are looking for

  • How To Use Family Sharing on one Apple ID ?

    OK....I like the new family sharing but I got around this in past in creative way. I have one AppleID that whole family uses.....no iCloud, only use ITunes to Sync, and on each iPhone or iPad for Text & Facetime I disable in settings all but that pho

  • How do i transfer my iweb content to new laptop?

    my hard drive on a mac book died - RIP. how do i download the content from my iweb account to my new laptop? the store clerk said that it was possible but doesn't seem obvious to me. i REALLY don't want to lose all my blog site content!

  • What is meant by an Activity in Business One

    Hi All,       What is meant by an Activity in Business One.I studied it in Business One Help,but it is not much helpful.I want a brief description regarding Activities(help me by taking an example).Where this activity used(only in Sales Opportunities

  • TREX Indexing of Primus Content

    Hi,     We are experimenting TREX to replace our current search engine. We need to be able to spider and index Primus knowldege base solutions. Do you know if there are any pre-built connectors available between TREX and Primus? Are do you know of an

  • Spin Wheel Appears Randomly

    I have recently been having a lot of problems with my 17 inch MacBook Pro. Very oftent, the spin wheel will appear randomly and lock into the spin mode... never getting out of it. I have let it run for long periods and it will continue to spin. I als