Sql Program help

Dear All,
I have an requirnment of a writing an sql program which works as follows :
Scenario:
1) If A (sw_serial_number) --->Issue(operation_type_id=1) ,then Refunded (operation_type_id=6) then i want to fetch customer details of A.
2) If A (sw_serial_number)--->Issue(operation_type_id-1) then Replaced(operation_type_id=5) with B and then Refunded (operation_type_id=6) ,then i require Customer Details of A.
Basically ..I want to do back-tracking and check whether an operation_type_id =1,6,5 has been done on sw_serial_number.
Conditions:
If (A=1 then A=6) then Customer Detail of A
IF (A=1 then A=5 then A-6 ) then Customer details of A.
Sample Query to fetch the old Sw_serial_number for new_serial_number is as follows:
WITH candidates AS
( select sw_serial_number,c.first_name,c.last_name,c.phone,c.email
from op_accounting_unit c
where c.pass_id =21
AND c.RECORD_DATE BETWEEN TO_DATE('04/01/2012 03:00:00', 'MM/DD/YYYY HH24:MI:SS')
AND TO_DATE('04/10/2012 03:00:00', 'MM/DD/YYYY HH24:MI:SS')
SELECT d.new_serial_number,d.old_serial_number,c.first_name,c.last_name,c.phone,c.email
FROM candidates c, MTVM_OP_REPLACEMENT d
WHERE c.sw_serial_number = d.old_serial_number
AND RECORD_DATE BETWEEN TO_DATE('01/01/2012 03:00:00', 'MM/DD/YYYY HH24:MI:SS')
AND TO_DATE('04/20/2012 03:00:00', 'MM/DD/YYYY HH24:MI:SS')
Thanks in Adavnce...

Hi Stew,
You are correct ,I have collected the data from my test Environment,
when operation_type_id = 5 happened in any sw_serial_number ,Only an entry of the sw_serial_number
with operation_type_id=5 inserted in op_accounting_unit and the information of Replacement
inserted in mtvm_op_replacement table.
Now this new_sw_serial_numeber have it's own records in op_accounting_unit
having a first operation_type_id as 5 ,Though we know that this new_sw_serial_number
has been Replaced by some sw_serial_number.
And in this case we need to know the original Sw_Serial_number customer details i.e the old_serial_number operation_type_id=1
Conditions:
Where 1=Issue ,5=Replacement,6=Refund
If (A=1 then A=6) then Customer Detail of A
IF (A=1 then A=5 then A-6 ) then Customer details of A.
Given below are the inserts for op_accounting_unit table (Issue i.e operation_type_id=1) , where customer details might be null as data is from testing environment.
Insert into op_accounting_unit (ACCOUNTING_ID,RECORD_DATE,UNIVERSAL_SEQ,DAILY_SEQ,EQUIPMENT_ID,EQUIPMENT_MODEL_ID,STATION_ID,HALL_ID,POSITION,START_DATE,RECORD_VERSION,RECORD_OFFSET,DATA_FILE,SHIFT_NUMBER,USER_ID,OPERATION_TYPE_ID,OPERATION_SEQ,PASS_ID,SUPPORT_TYPE_ID,SUPPORT_ID,CS_DATA_ID,SW_SERIAL_NUMBER,NUM_TRIPS,REMAINING_TRIPS,CHARGED_AMOUNT,REMAINING_AMOUNT,PASS_PRICE,DEPOSIT,SUPPORT_PRICE,NUM_TOKENS,IS_IDENTIFIED,IDENTIFICATION_TYPE,COUNTRY_CODE,DOCUMENT_ID,IS_CANCELLED,IS_TEST,IS_EXPORTED,FIRST_NAME,LAST_NAME,GENDER,ADDRESS,PHONE,EMAIL,PROOF) values (33692615,to_date('20-APR-12 12:05:37','DD-MON-RR HH24:MI:SS'),5168,97,1001,2,1,1,2,to_date('23-FEB-11 00:00:00','DD-MON-RR HH24:MI:SS'),2,22703,'MTVM_01001_120420.dat',143,1,1,435,10,1,1,38597646,50808,1,0,0,0,2000,0,0,1,0,null,null,null,0,0,0,null,null,null,null,null,null,null);
Insert into op_accounting_unit (ACCOUNTING_ID,RECORD_DATE,UNIVERSAL_SEQ,DAILY_SEQ,EQUIPMENT_ID,EQUIPMENT_MODEL_ID,STATION_ID,HALL_ID,POSITION,START_DATE,RECORD_VERSION,RECORD_OFFSET,DATA_FILE,SHIFT_NUMBER,USER_ID,OPERATION_TYPE_ID,OPERATION_SEQ,PASS_ID,SUPPORT_TYPE_ID,SUPPORT_ID,CS_DATA_ID,SW_SERIAL_NUMBER,NUM_TRIPS,REMAINING_TRIPS,CHARGED_AMOUNT,REMAINING_AMOUNT,PASS_PRICE,DEPOSIT,SUPPORT_PRICE,NUM_TOKENS,IS_IDENTIFIED,IDENTIFICATION_TYPE,COUNTRY_CODE,DOCUMENT_ID,IS_CANCELLED,IS_TEST,IS_EXPORTED,FIRST_NAME,LAST_NAME,GENDER,ADDRESS,PHONE,EMAIL,PROOF) values (33692615,to_date('20-APR-12 12:05:45','DD-MON-RR HH24:MI:SS'),5169,98,1001,2,1,1,2,to_date('23-FEB-11 00:00:00','DD-MON-RR HH24:MI:SS'),2,22963,'MTVM_01001_120420.dat',143,1,1,435,10,1,1,38597647,24703,1,0,0,0,2000,0,0,1,0,null,null,null,0,0,0,null,null,null,null,null,null,null);
Insert into op_accounting_unit (ACCOUNTING_ID,RECORD_DATE,UNIVERSAL_SEQ,DAILY_SEQ,EQUIPMENT_ID,EQUIPMENT_MODEL_ID,STATION_ID,HALL_ID,POSITION,START_DATE,RECORD_VERSION,RECORD_OFFSET,DATA_FILE,SHIFT_NUMBER,USER_ID,OPERATION_TYPE_ID,OPERATION_SEQ,PASS_ID,SUPPORT_TYPE_ID,SUPPORT_ID,CS_DATA_ID,SW_SERIAL_NUMBER,NUM_TRIPS,REMAINING_TRIPS,CHARGED_AMOUNT,REMAINING_AMOUNT,PASS_PRICE,DEPOSIT,SUPPORT_PRICE,NUM_TOKENS,IS_IDENTIFIED,IDENTIFICATION_TYPE,COUNTRY_CODE,DOCUMENT_ID,IS_CANCELLED,IS_TEST,IS_EXPORTED,FIRST_NAME,LAST_NAME,GENDER,ADDRESS,PHONE,EMAIL,PROOF) values (33692616,to_date('20-APR-12 12:06:32','DD-MON-RR HH24:MI:SS'),5171,100,1001,2,1,1,2,to_date('23-FEB-11 00:00:00','DD-MON-RR HH24:MI:SS'),2,23638,'MTVM_01001_120420.dat',143,1,1,436,10,1,1,38597648,50808,1,0,0,0,2000,0,0,1,0,null,null,null,0,0,0,null,null,null,null,null,null,null);
Insert into op_accounting_unit (ACCOUNTING_ID,RECORD_DATE,UNIVERSAL_SEQ,DAILY_SEQ,EQUIPMENT_ID,EQUIPMENT_MODEL_ID,STATION_ID,HALL_ID,POSITION,START_DATE,RECORD_VERSION,RECORD_OFFSET,DATA_FILE,SHIFT_NUMBER,USER_ID,OPERATION_TYPE_ID,OPERATION_SEQ,PASS_ID,SUPPORT_TYPE_ID,SUPPORT_ID,CS_DATA_ID,SW_SERIAL_NUMBER,NUM_TRIPS,REMAINING_TRIPS,CHARGED_AMOUNT,REMAINING_AMOUNT,PASS_PRICE,DEPOSIT,SUPPORT_PRICE,NUM_TOKENS,IS_IDENTIFIED,IDENTIFICATION_TYPE,COUNTRY_CODE,DOCUMENT_ID,IS_CANCELLED,IS_TEST,IS_EXPORTED,FIRST_NAME,LAST_NAME,GENDER,ADDRESS,PHONE,EMAIL,PROOF) values (33692624,to_date('20-APR-12 12:17:00','DD-MON-RR HH24:MI:SS'),5177,106,1001,2,1,1,2,to_date('23-FEB-11 00:00:00','DD-MON-RR HH24:MI:SS'),2,25154,'MTVM_01001_120420.dat',143,1,1,437,10,1,1,38597658,24703,1,0,0,0,2000,0,0,1,0,null,null,null,0,0,0,null,null,null,null,null,null,null);
Insert into op_accounting_unit (ACCOUNTING_ID,RECORD_DATE,UNIVERSAL_SEQ,DAILY_SEQ,EQUIPMENT_ID,EQUIPMENT_MODEL_ID,STATION_ID,HALL_ID,POSITION,START_DATE,RECORD_VERSION,RECORD_OFFSET,DATA_FILE,SHIFT_NUMBER,USER_ID,OPERATION_TYPE_ID,OPERATION_SEQ,PASS_ID,SUPPORT_TYPE_ID,SUPPORT_ID,CS_DATA_ID,SW_SERIAL_NUMBER,NUM_TRIPS,REMAINING_TRIPS,CHARGED_AMOUNT,REMAINING_AMOUNT,PASS_PRICE,DEPOSIT,SUPPORT_PRICE,NUM_TOKENS,IS_IDENTIFIED,IDENTIFICATION_TYPE,COUNTRY_CODE,DOCUMENT_ID,IS_CANCELLED,IS_TEST,IS_EXPORTED,FIRST_NAME,LAST_NAME,GENDER,ADDRESS,PHONE,EMAIL,PROOF) values (33692660,to_date('20-APR-12 13:08:25','DD-MON-RR HH24:MI:SS'),5206,135,1001,2,1,1,2,to_date('23-FEB-11 00:00:00','DD-MON-RR HH24:MI:SS'),2,31682,'MTVM_01001_120420.dat',145,1,1,438,10,1,1,38597695,50734,1,0,0,0,2000,0,0,1,0,null,null,null,0,0,0,null,null,null,null,null,null,null);
Insert into op_accounting_unit (ACCOUNTING_ID,RECORD_DATE,UNIVERSAL_SEQ,DAILY_SEQ,EQUIPMENT_ID,EQUIPMENT_MODEL_ID,STATION_ID,HALL_ID,POSITION,START_DATE,RECORD_VERSION,RECORD_OFFSET,DATA_FILE,SHIFT_NUMBER,USER_ID,OPERATION_TYPE_ID,OPERATION_SEQ,PASS_ID,SUPPORT_TYPE_ID,SUPPORT_ID,CS_DATA_ID,SW_SERIAL_NUMBER,NUM_TRIPS,REMAINING_TRIPS,CHARGED_AMOUNT,REMAINING_AMOUNT,PASS_PRICE,DEPOSIT,SUPPORT_PRICE,NUM_TOKENS,IS_IDENTIFIED,IDENTIFICATION_TYPE,COUNTRY_CODE,DOCUMENT_ID,IS_CANCELLED,IS_TEST,IS_EXPORTED,FIRST_NAME,LAST_NAME,GENDER,ADDRESS,PHONE,EMAIL,PROOF) values (33692704,to_date('20-APR-12 14:21:14','DD-MON-RR HH24:MI:SS'),5226,155,1001,2,1,1,2,to_date('23-FEB-11 00:00:00','DD-MON-RR HH24:MI:SS'),2,36265,'MTVM_01001_120420.dat',146,1,1,440,10,1,1,38597741,50842,1,0,0,0,2000,0,0,1,0,null,null,null,0,0,0,null,null,null,null,null,null,null);
Insert into op_accounting_unit (ACCOUNTING_ID,RECORD_DATE,UNIVERSAL_SEQ,DAILY_SEQ,EQUIPMENT_ID,EQUIPMENT_MODEL_ID,STATION_ID,HALL_ID,POSITION,START_DATE,RECORD_VERSION,RECORD_OFFSET,DATA_FILE,SHIFT_NUMBER,USER_ID,OPERATION_TYPE_ID,OPERATION_SEQ,PASS_ID,SUPPORT_TYPE_ID,SUPPORT_ID,CS_DATA_ID,SW_SERIAL_NUMBER,NUM_TRIPS,REMAINING_TRIPS,CHARGED_AMOUNT,REMAINING_AMOUNT,PASS_PRICE,DEPOSIT,SUPPORT_PRICE,NUM_TOKENS,IS_IDENTIFIED,IDENTIFICATION_TYPE,COUNTRY_CODE,DOCUMENT_ID,IS_CANCELLED,IS_TEST,IS_EXPORTED,FIRST_NAME,LAST_NAME,GENDER,ADDRESS,PHONE,EMAIL,PROOF) values (33692706,to_date('20-APR-12 14:22:27','DD-MON-RR HH24:MI:SS'),5232,161,1001,2,1,1,2,to_date('23-FEB-11 00:00:00','DD-MON-RR HH24:MI:SS'),2,37937,'MTVM_01001_120420.dat',146,1,1,442,10,1,1,38597743,7493,1,0,0,0,2000,0,0,1,0,null,null,null,0,0,0,null,null,null,null,null,null,null);
Insert into op_accounting_unit (ACCOUNTING_ID,RECORD_DATE,UNIVERSAL_SEQ,DAILY_SEQ,EQUIPMENT_ID,EQUIPMENT_MODEL_ID,STATION_ID,HALL_ID,POSITION,START_DATE,RECORD_VERSION,RECORD_OFFSET,DATA_FILE,SHIFT_NUMBER,USER_ID,OPERATION_TYPE_ID,OPERATION_SEQ,PASS_ID,SUPPORT_TYPE_ID,SUPPORT_ID,CS_DATA_ID,SW_SERIAL_NUMBER,NUM_TRIPS,REMAINING_TRIPS,CHARGED_AMOUNT,REMAINING_AMOUNT,PASS_PRICE,DEPOSIT,SUPPORT_PRICE,NUM_TOKENS,IS_IDENTIFIED,IDENTIFICATION_TYPE,COUNTRY_CODE,DOCUMENT_ID,IS_CANCELLED,IS_TEST,IS_EXPORTED,FIRST_NAME,LAST_NAME,GENDER,ADDRESS,PHONE,EMAIL,PROOF) values (33692750,to_date('20-APR-12 15:10:15','DD-MON-RR HH24:MI:SS'),5295,224,1001,2,1,1,2,to_date('23-FEB-11 00:00:00','DD-MON-RR HH24:MI:SS'),2,52840,'MTVM_01001_120420.dat',149,1,1,451,21,2,2,38597788,30263,60,60,0,0,120000,10000,30000,1,1,0,356,null,0,0,0,'PANKAJ',null,1,null,'123123123',null,0);
Insert into op_accounting_unit (ACCOUNTING_ID,RECORD_DATE,UNIVERSAL_SEQ,DAILY_SEQ,EQUIPMENT_ID,EQUIPMENT_MODEL_ID,STATION_ID,HALL_ID,POSITION,START_DATE,RECORD_VERSION,RECORD_OFFSET,DATA_FILE,SHIFT_NUMBER,USER_ID,OPERATION_TYPE_ID,OPERATION_SEQ,PASS_ID,SUPPORT_TYPE_ID,SUPPORT_ID,CS_DATA_ID,SW_SERIAL_NUMBER,NUM_TRIPS,REMAINING_TRIPS,CHARGED_AMOUNT,REMAINING_AMOUNT,PASS_PRICE,DEPOSIT,SUPPORT_PRICE,NUM_TOKENS,IS_IDENTIFIED,IDENTIFICATION_TYPE,COUNTRY_CODE,DOCUMENT_ID,IS_CANCELLED,IS_TEST,IS_EXPORTED,FIRST_NAME,LAST_NAME,GENDER,ADDRESS,PHONE,EMAIL,PROOF) values (33696305,to_date('23-APR-12 11:10:33','DD-MON-RR HH24:MI:SS'),5378,22,1001,2,1,1,2,to_date('23-FEB-11 00:00:00','DD-MON-RR HH24:MI:SS'),2,5351,'MTVM_01001_120423.dat',151,1,1,462,10,1,1,38601353,50772,1,0,0,0,10000,0,0,1,0,null,null,null,0,0,0,null,null,null,null,null,null,null);
Insert into op_accounting_unit (ACCOUNTING_ID,RECORD_DATE,UNIVERSAL_SEQ,DAILY_SEQ,EQUIPMENT_ID,EQUIPMENT_MODEL_ID,STATION_ID,HALL_ID,POSITION,START_DATE,RECORD_VERSION,RECORD_OFFSET,DATA_FILE,SHIFT_NUMBER,USER_ID,OPERATION_TYPE_ID,OPERATION_SEQ,PASS_ID,SUPPORT_TYPE_ID,SUPPORT_ID,CS_DATA_ID,SW_SERIAL_NUMBER,NUM_TRIPS,REMAINING_TRIPS,CHARGED_AMOUNT,REMAINING_AMOUNT,PASS_PRICE,DEPOSIT,SUPPORT_PRICE,NUM_TOKENS,IS_IDENTIFIED,IDENTIFICATION_TYPE,COUNTRY_CODE,DOCUMENT_ID,IS_CANCELLED,IS_TEST,IS_EXPORTED,FIRST_NAME,LAST_NAME,GENDER,ADDRESS,PHONE,EMAIL,PROOF) values (33696305,to_date('23-APR-12 11:12:53','DD-MON-RR HH24:MI:SS'),5390,34,1001,2,1,1,2,to_date('23-FEB-11 00:00:00','DD-MON-RR HH24:MI:SS'),2,8048,'MTVM_01001_120423.dat',152,1,1,462,10,1,1,38601354,44640,1,0,0,0,10000,0,0,1,0,null,null,null,0,0,0,null,null,null,null,null,null,null);
Details from op_accounting_unit for (Replacement and Refund i.e operation_type_id=5 and 6 respectively)
Insert into op_accounting_unit (ACCOUNTING_ID,RECORD_DATE,UNIVERSAL_SEQ,DAILY_SEQ,EQUIPMENT_ID,EQUIPMENT_MODEL_ID,STATION_ID,HALL_ID,POSITION,START_DATE,RECORD_VERSION,RECORD_OFFSET,DATA_FILE,SHIFT_NUMBER,USER_ID,OPERATION_TYPE_ID,OPERATION_SEQ,PASS_ID,SUPPORT_TYPE_ID,SUPPORT_ID,CS_DATA_ID,SW_SERIAL_NUMBER,NUM_TRIPS,REMAINING_TRIPS,CHARGED_AMOUNT,REMAINING_AMOUNT,PASS_PRICE,DEPOSIT,SUPPORT_PRICE,NUM_TOKENS,IS_IDENTIFIED,IDENTIFICATION_TYPE,COUNTRY_CODE,DOCUMENT_ID,IS_CANCELLED,IS_TEST,IS_EXPORTED,FIRST_NAME,LAST_NAME,GENDER,ADDRESS,PHONE,EMAIL,PROOF) values (33692571,to_date('20-APR-12 11:24:55','DD-MON-RR HH24:MI:SS'),5088,17,1001,2,1,1,2,to_date('23-FEB-11 00:00:00','DD-MON-RR HH24:MI:SS'),2,3516,'MTVM_01001_120420.dat',141,1,6,421,54,2,2,38597600,30362,45,42,0,0,0,10000,0,1,0,null,null,null,0,0,0,null,null,null,null,null,null,null);
Insert into op_accounting_unit (ACCOUNTING_ID,RECORD_DATE,UNIVERSAL_SEQ,DAILY_SEQ,EQUIPMENT_ID,EQUIPMENT_MODEL_ID,STATION_ID,HALL_ID,POSITION,START_DATE,RECORD_VERSION,RECORD_OFFSET,DATA_FILE,SHIFT_NUMBER,USER_ID,OPERATION_TYPE_ID,OPERATION_SEQ,PASS_ID,SUPPORT_TYPE_ID,SUPPORT_ID,CS_DATA_ID,SW_SERIAL_NUMBER,NUM_TRIPS,REMAINING_TRIPS,CHARGED_AMOUNT,REMAINING_AMOUNT,PASS_PRICE,DEPOSIT,SUPPORT_PRICE,NUM_TOKENS,IS_IDENTIFIED,IDENTIFICATION_TYPE,COUNTRY_CODE,DOCUMENT_ID,IS_CANCELLED,IS_TEST,IS_EXPORTED,FIRST_NAME,LAST_NAME,GENDER,ADDRESS,PHONE,EMAIL,PROOF) values (33692580,to_date('20-APR-12 11:28:45','DD-MON-RR HH24:MI:SS'),5096,25,1001,2,1,1,2,to_date('23-FEB-11 00:00:00','DD-MON-RR HH24:MI:SS'),2,5283,'MTVM_01001_120420.dat',141,1,6,423,21,2,2,38597609,30362,60,59,0,0,0,10000,0,1,0,null,null,null,0,0,0,null,null,null,null,null,null,null);
Insert into op_accounting_unit (ACCOUNTING_ID,RECORD_DATE,UNIVERSAL_SEQ,DAILY_SEQ,EQUIPMENT_ID,EQUIPMENT_MODEL_ID,STATION_ID,HALL_ID,POSITION,START_DATE,RECORD_VERSION,RECORD_OFFSET,DATA_FILE,SHIFT_NUMBER,USER_ID,OPERATION_TYPE_ID,OPERATION_SEQ,PASS_ID,SUPPORT_TYPE_ID,SUPPORT_ID,CS_DATA_ID,SW_SERIAL_NUMBER,NUM_TRIPS,REMAINING_TRIPS,CHARGED_AMOUNT,REMAINING_AMOUNT,PASS_PRICE,DEPOSIT,SUPPORT_PRICE,NUM_TOKENS,IS_IDENTIFIED,IDENTIFICATION_TYPE,COUNTRY_CODE,DOCUMENT_ID,IS_CANCELLED,IS_TEST,IS_EXPORTED,FIRST_NAME,LAST_NAME,GENDER,ADDRESS,PHONE,EMAIL,PROOF) values (33692583,to_date('20-APR-12 11:33:27','DD-MON-RR HH24:MI:SS'),5103,32,1001,2,1,1,2,to_date('23-FEB-11 00:00:00','DD-MON-RR HH24:MI:SS'),2,6992,'MTVM_01001_120420.dat',141,1,6,425,81,2,2,38597612,123456789,0,0,0,5000000,500000,10000,0,1,0,null,null,null,0,0,0,null,null,null,null,null,null,null);
Insert into op_accounting_unit (ACCOUNTING_ID,RECORD_DATE,UNIVERSAL_SEQ,DAILY_SEQ,EQUIPMENT_ID,EQUIPMENT_MODEL_ID,STATION_ID,HALL_ID,POSITION,START_DATE,RECORD_VERSION,RECORD_OFFSET,DATA_FILE,SHIFT_NUMBER,USER_ID,OPERATION_TYPE_ID,OPERATION_SEQ,PASS_ID,SUPPORT_TYPE_ID,SUPPORT_ID,CS_DATA_ID,SW_SERIAL_NUMBER,NUM_TRIPS,REMAINING_TRIPS,CHARGED_AMOUNT,REMAINING_AMOUNT,PASS_PRICE,DEPOSIT,SUPPORT_PRICE,NUM_TOKENS,IS_IDENTIFIED,IDENTIFICATION_TYPE,COUNTRY_CODE,DOCUMENT_ID,IS_CANCELLED,IS_TEST,IS_EXPORTED,FIRST_NAME,LAST_NAME,GENDER,ADDRESS,PHONE,EMAIL,PROOF) values (33692585,to_date('20-APR-12 11:36:53','DD-MON-RR HH24:MI:SS'),5110,39,1001,2,1,1,2,to_date('23-FEB-11 00:00:00','DD-MON-RR HH24:MI:SS'),2,8687,'MTVM_01001_120420.dat',141,1,6,427,21,2,2,38597614,30360,60,60,0,0,0,10000,0,1,0,null,null,null,0,0,0,null,null,null,null,null,null,null);
Insert into op_accounting_unit (ACCOUNTING_ID,RECORD_DATE,UNIVERSAL_SEQ,DAILY_SEQ,EQUIPMENT_ID,EQUIPMENT_MODEL_ID,STATION_ID,HALL_ID,POSITION,START_DATE,RECORD_VERSION,RECORD_OFFSET,DATA_FILE,SHIFT_NUMBER,USER_ID,OPERATION_TYPE_ID,OPERATION_SEQ,PASS_ID,SUPPORT_TYPE_ID,SUPPORT_ID,CS_DATA_ID,SW_SERIAL_NUMBER,NUM_TRIPS,REMAINING_TRIPS,CHARGED_AMOUNT,REMAINING_AMOUNT,PASS_PRICE,DEPOSIT,SUPPORT_PRICE,NUM_TOKENS,IS_IDENTIFIED,IDENTIFICATION_TYPE,COUNTRY_CODE,DOCUMENT_ID,IS_CANCELLED,IS_TEST,IS_EXPORTED,FIRST_NAME,LAST_NAME,GENDER,ADDRESS,PHONE,EMAIL,PROOF) values (33692593,to_date('20-APR-12 11:39:09','DD-MON-RR HH24:MI:SS'),5124,53,1001,2,1,1,2,to_date('23-FEB-11 00:00:00','DD-MON-RR HH24:MI:SS'),2,12092,'MTVM_01001_120420.dat',142,1,5,428,54,2,2,38597624,30360,45,3392,0,0,0,0,0,1,1,-1,356,null,0,0,0,null,null,-1,null,null,null,-1);
Insert into op_accounting_unit (ACCOUNTING_ID,RECORD_DATE,UNIVERSAL_SEQ,DAILY_SEQ,EQUIPMENT_ID,EQUIPMENT_MODEL_ID,STATION_ID,HALL_ID,POSITION,START_DATE,RECORD_VERSION,RECORD_OFFSET,DATA_FILE,SHIFT_NUMBER,USER_ID,OPERATION_TYPE_ID,OPERATION_SEQ,PASS_ID,SUPPORT_TYPE_ID,SUPPORT_ID,CS_DATA_ID,SW_SERIAL_NUMBER,NUM_TRIPS,REMAINING_TRIPS,CHARGED_AMOUNT,REMAINING_AMOUNT,PASS_PRICE,DEPOSIT,SUPPORT_PRICE,NUM_TOKENS,IS_IDENTIFIED,IDENTIFICATION_TYPE,COUNTRY_CODE,DOCUMENT_ID,IS_CANCELLED,IS_TEST,IS_EXPORTED,FIRST_NAME,LAST_NAME,GENDER,ADDRESS,PHONE,EMAIL,PROOF) values (33692594,to_date('20-APR-12 11:44:37','DD-MON-RR HH24:MI:SS'),5133,62,1001,2,1,1,2,to_date('23-FEB-11 00:00:00','DD-MON-RR HH24:MI:SS'),2,14260,'MTVM_01001_120420.dat',142,1,6,429,21,2,2,38597625,1296,60,59,0,0,0,10000,0,1,0,null,null,null,0,0,0,null,null,null,null,null,null,null);
Insert into op_accounting_unit (ACCOUNTING_ID,RECORD_DATE,UNIVERSAL_SEQ,DAILY_SEQ,EQUIPMENT_ID,EQUIPMENT_MODEL_ID,STATION_ID,HALL_ID,POSITION,START_DATE,RECORD_VERSION,RECORD_OFFSET,DATA_FILE,SHIFT_NUMBER,USER_ID,OPERATION_TYPE_ID,OPERATION_SEQ,PASS_ID,SUPPORT_TYPE_ID,SUPPORT_ID,CS_DATA_ID,SW_SERIAL_NUMBER,NUM_TRIPS,REMAINING_TRIPS,CHARGED_AMOUNT,REMAINING_AMOUNT,PASS_PRICE,DEPOSIT,SUPPORT_PRICE,NUM_TOKENS,IS_IDENTIFIED,IDENTIFICATION_TYPE,COUNTRY_CODE,DOCUMENT_ID,IS_CANCELLED,IS_TEST,IS_EXPORTED,FIRST_NAME,LAST_NAME,GENDER,ADDRESS,PHONE,EMAIL,PROOF) values (33692604,to_date('20-APR-12 11:53:36','DD-MON-RR HH24:MI:SS'),5154,83,1001,2,1,1,2,to_date('23-FEB-11 00:00:00','DD-MON-RR HH24:MI:SS'),2,19049,'MTVM_01001_120420.dat',143,1,6,431,54,2,2,38597635,1296,45,42,0,0,0,10000,0,1,0,null,null,null,0,0,0,null,null,null,null,null,null,null);
Insert into op_accounting_unit (ACCOUNTING_ID,RECORD_DATE,UNIVERSAL_SEQ,DAILY_SEQ,EQUIPMENT_ID,EQUIPMENT_MODEL_ID,STATION_ID,HALL_ID,POSITION,START_DATE,RECORD_VERSION,RECORD_OFFSET,DATA_FILE,SHIFT_NUMBER,USER_ID,OPERATION_TYPE_ID,OPERATION_SEQ,PASS_ID,SUPPORT_TYPE_ID,SUPPORT_ID,CS_DATA_ID,SW_SERIAL_NUMBER,NUM_TRIPS,REMAINING_TRIPS,CHARGED_AMOUNT,REMAINING_AMOUNT,PASS_PRICE,DEPOSIT,SUPPORT_PRICE,NUM_TOKENS,IS_IDENTIFIED,IDENTIFICATION_TYPE,COUNTRY_CODE,DOCUMENT_ID,IS_CANCELLED,IS_TEST,IS_EXPORTED,FIRST_NAME,LAST_NAME,GENDER,ADDRESS,PHONE,EMAIL,PROOF) values (33692606,to_date('20-APR-12 11:55:00','DD-MON-RR HH24:MI:SS'),5163,92,1001,2,1,1,2,to_date('23-FEB-11 00:00:00','DD-MON-RR HH24:MI:SS'),2,21318,'MTVM_01001_120420.dat',143,1,6,433,81,2,2,38597637,1296,0,0,0,500000,50000,10000,0,1,0,null,null,null,0,0,0,null,null,null,null,null,null,null);
Insert into op_accounting_unit (ACCOUNTING_ID,RECORD_DATE,UNIVERSAL_SEQ,DAILY_SEQ,EQUIPMENT_ID,EQUIPMENT_MODEL_ID,STATION_ID,HALL_ID,POSITION,START_DATE,RECORD_VERSION,RECORD_OFFSET,DATA_FILE,SHIFT_NUMBER,USER_ID,OPERATION_TYPE_ID,OPERATION_SEQ,PASS_ID,SUPPORT_TYPE_ID,SUPPORT_ID,CS_DATA_ID,SW_SERIAL_NUMBER,NUM_TRIPS,REMAINING_TRIPS,CHARGED_AMOUNT,REMAINING_AMOUNT,PASS_PRICE,DEPOSIT,SUPPORT_PRICE,NUM_TOKENS,IS_IDENTIFIED,IDENTIFICATION_TYPE,COUNTRY_CODE,DOCUMENT_ID,IS_CANCELLED,IS_TEST,IS_EXPORTED,FIRST_NAME,LAST_NAME,GENDER,ADDRESS,PHONE,EMAIL,PROOF) values (33692749,to_date('20-APR-12 15:09:47','DD-MON-RR HH24:MI:SS'),5293,222,1001,2,1,1,2,to_date('23-FEB-11 00:00:00','DD-MON-RR HH24:MI:SS'),2,52165,'MTVM_01001_120420.dat',149,1,6,450,21,2,2,38597787,30263,60,56,0,0,0,10000,0,1,0,null,null,null,0,0,0,null,null,null,null,null,null,null);
Insert into op_accounting_unit (ACCOUNTING_ID,RECORD_DATE,UNIVERSAL_SEQ,DAILY_SEQ,EQUIPMENT_ID,EQUIPMENT_MODEL_ID,STATION_ID,HALL_ID,POSITION,START_DATE,RECORD_VERSION,RECORD_OFFSET,DATA_FILE,SHIFT_NUMBER,USER_ID,OPERATION_TYPE_ID,OPERATION_SEQ,PASS_ID,SUPPORT_TYPE_ID,SUPPORT_ID,CS_DATA_ID,SW_SERIAL_NUMBER,NUM_TRIPS,REMAINING_TRIPS,CHARGED_AMOUNT,REMAINING_AMOUNT,PASS_PRICE,DEPOSIT,SUPPORT_PRICE,NUM_TOKENS,IS_IDENTIFIED,IDENTIFICATION_TYPE,COUNTRY_CODE,DOCUMENT_ID,IS_CANCELLED,IS_TEST,IS_EXPORTED,FIRST_NAME,LAST_NAME,GENDER,ADDRESS,PHONE,EMAIL,PROOF) values (33692752,to_date('20-APR-12 15:12:03','DD-MON-RR HH24:MI:SS'),5306,235,1001,2,1,1,2,to_date('23-FEB-11 00:00:00','DD-MON-RR HH24:MI:SS'),2,55588,'MTVM_01001_120420.dat',149,1,6,453,21,2,2,38597790,305419896,60,60,0,0,120000,10000,0,1,0,null,null,null,0,0,0,null,null,null,null,null,null,null);
Insert into op_accounting_unit (ACCOUNTING_ID,RECORD_DATE,UNIVERSAL_SEQ,DAILY_SEQ,EQUIPMENT_ID,EQUIPMENT_MODEL_ID,STATION_ID,HALL_ID,POSITION,START_DATE,RECORD_VERSION,RECORD_OFFSET,DATA_FILE,SHIFT_NUMBER,USER_ID,OPERATION_TYPE_ID,OPERATION_SEQ,PASS_ID,SUPPORT_TYPE_ID,SUPPORT_ID,CS_DATA_ID,SW_SERIAL_NUMBER,NUM_TRIPS,REMAINING_TRIPS,CHARGED_AMOUNT,REMAINING_AMOUNT,PASS_PRICE,DEPOSIT,SUPPORT_PRICE,NUM_TOKENS,IS_IDENTIFIED,IDENTIFICATION_TYPE,COUNTRY_CODE,DOCUMENT_ID,IS_CANCELLED,IS_TEST,IS_EXPORTED,FIRST_NAME,LAST_NAME,GENDER,ADDRESS,PHONE,EMAIL,PROOF) values (33692753,to_date('20-APR-12 15:15:40','DD-MON-RR HH24:MI:SS'),5323,252,1001,2,1,1,2,to_date('23-FEB-11 00:00:00','DD-MON-RR HH24:MI:SS'),2,59459,'MTVM_01001_120420.dat',150,1,6,454,21,2,2,38597791,50658,60,59,0,0,0,10000,0,1,0,null,null,null,0,0,0,null,null,null,null,null,null,null);
Insert into op_accounting_unit (ACCOUNTING_ID,RECORD_DATE,UNIVERSAL_SEQ,DAILY_SEQ,EQUIPMENT_ID,EQUIPMENT_MODEL_ID,STATION_ID,HALL_ID,POSITION,START_DATE,RECORD_VERSION,RECORD_OFFSET,DATA_FILE,SHIFT_NUMBER,USER_ID,OPERATION_TYPE_ID,OPERATION_SEQ,PASS_ID,SUPPORT_TYPE_ID,SUPPORT_ID,CS_DATA_ID,SW_SERIAL_NUMBER,NUM_TRIPS,REMAINING_TRIPS,CHARGED_AMOUNT,REMAINING_AMOUNT,PASS_PRICE,DEPOSIT,SUPPORT_PRICE,NUM_TOKENS,IS_IDENTIFIED,IDENTIFICATION_TYPE,COUNTRY_CODE,DOCUMENT_ID,IS_CANCELLED,IS_TEST,IS_EXPORTED,FIRST_NAME,LAST_NAME,GENDER,ADDRESS,PHONE,EMAIL,PROOF) values (33692754,to_date('20-APR-12 15:16:10','DD-MON-RR HH24:MI:SS'),5330,259,1001,2,1,1,2,to_date('23-FEB-11 00:00:00','DD-MON-RR HH24:MI:SS'),2,60497,'MTVM_01001_120420.dat',150,1,6,455,54,2,2,38597792,123456789,45,45,0,0,0,10000,0,1,0,null,null,null,0,0,0,null,null,null,null,null,null,null);
Insert into op_accounting_unit (ACCOUNTING_ID,RECORD_DATE,UNIVERSAL_SEQ,DAILY_SEQ,EQUIPMENT_ID,EQUIPMENT_MODEL_ID,STATION_ID,HALL_ID,POSITION,START_DATE,RECORD_VERSION,RECORD_OFFSET,DATA_FILE,SHIFT_NUMBER,USER_ID,OPERATION_TYPE_ID,OPERATION_SEQ,PASS_ID,SUPPORT_TYPE_ID,SUPPORT_ID,CS_DATA_ID,SW_SERIAL_NUMBER,NUM_TRIPS,REMAINING_TRIPS,CHARGED_AMOUNT,REMAINING_AMOUNT,PASS_PRICE,DEPOSIT,SUPPORT_PRICE,NUM_TOKENS,IS_IDENTIFIED,IDENTIFICATION_TYPE,COUNTRY_CODE,DOCUMENT_ID,IS_CANCELLED,IS_TEST,IS_EXPORTED,FIRST_NAME,LAST_NAME,GENDER,ADDRESS,PHONE,EMAIL,PROOF) values (33692756,to_date('20-APR-12 15:17:02','DD-MON-RR HH24:MI:SS'),5337,266,1001,2,1,1,2,to_date('23-FEB-11 00:00:00','DD-MON-RR HH24:MI:SS'),2,62613,'MTVM_01001_120420.dat',150,1,5,457,21,2,2,38597795,305419896,60,54464,0,0,0,0,0,1,1,-1,356,null,0,0,0,null,null,-1,null,null,null,-1);
Insert into op_accounting_unit (ACCOUNTING_ID,RECORD_DATE,UNIVERSAL_SEQ,DAILY_SEQ,EQUIPMENT_ID,EQUIPMENT_MODEL_ID,STATION_ID,HALL_ID,POSITION,START_DATE,RECORD_VERSION,RECORD_OFFSET,DATA_FILE,SHIFT_NUMBER,USER_ID,OPERATION_TYPE_ID,OPERATION_SEQ,PASS_ID,SUPPORT_TYPE_ID,SUPPORT_ID,CS_DATA_ID,SW_SERIAL_NUMBER,NUM_TRIPS,REMAINING_TRIPS,CHARGED_AMOUNT,REMAINING_AMOUNT,PASS_PRICE,DEPOSIT,SUPPORT_PRICE,NUM_TOKENS,IS_IDENTIFIED,IDENTIFICATION_TYPE,COUNTRY_CODE,DOCUMENT_ID,IS_CANCELLED,IS_TEST,IS_EXPORTED,FIRST_NAME,LAST_NAME,GENDER,ADDRESS,PHONE,EMAIL,PROOF) values (33692757,to_date('20-APR-12 15:17:34','DD-MON-RR HH24:MI:SS'),5341,270,1001,2,1,1,2,to_date('23-FEB-11 00:00:00','DD-MON-RR HH24:MI:SS'),2,63767,'MTVM_01001_120420.dat',150,1,5,458,21,2,2,38597797,50658,60,54464,0,0,0,0,0,1,1,-1,356,null,0,0,0,null,null,-1,null,null,null,-1);
Details from mtvm_op_replacement
Insert into mtvm_op_replacement (ACCOUNTING_ID,RECORD_DATE,UNIVERSAL_SEQ,DAILY_SEQ,EQUIPMENT_ID,EQUIPMENT_MODEL_ID,STATION_ID,HALL_ID,POSITION,START_DATE,RECORD_VERSION,RECORD_OFFSET,DATA_FILE,SHIFT_NUMBER,USER_ID,OPERATION_SEQ,REASON_ID,SLIP_NUMBER,REFUND_LEVEL,PASS_ID,SUPPORT_TYPE_ID,SUPPORT_ID,CS_DATA_ID,OLD_SERIAL_NUMBER,NEW_SERIAL_NUMBER,REPLACEMENT_AMOUNT,DEPOSIT_AMOUNT,SUPPORT_AMOUNT,EXPIRATION_DATE,IS_IDENTIFIED,IDENTIFICATION_TYPE,COUNTRY_CODE,DOCUMENT_ID) values (33692593,to_date('20-APR-12 11:39:08','DD-MON-RR HH24:MI:SS'),5123,52,1001,2,1,1,2,to_date('23-FEB-11 00:00:00','DD-MON-RR HH24:MI:SS'),1,11808,'MTVM_01001_120420.dat',142,1,428,0,'0',1,null,2,2,38597623,123456789,30360,0,0,0,null,1,-1,356,null);
Insert into mtvm_op_replacement (ACCOUNTING_ID,RECORD_DATE,UNIVERSAL_SEQ,DAILY_SEQ,EQUIPMENT_ID,EQUIPMENT_MODEL_ID,STATION_ID,HALL_ID,POSITION,START_DATE,RECORD_VERSION,RECORD_OFFSET,DATA_FILE,SHIFT_NUMBER,USER_ID,OPERATION_SEQ,REASON_ID,SLIP_NUMBER,REFUND_LEVEL,PASS_ID,SUPPORT_TYPE_ID,SUPPORT_ID,CS_DATA_ID,OLD_SERIAL_NUMBER,NEW_SERIAL_NUMBER,REPLACEMENT_AMOUNT,DEPOSIT_AMOUNT,SUPPORT_AMOUNT,EXPIRATION_DATE,IS_IDENTIFIED,IDENTIFICATION_TYPE,COUNTRY_CODE,DOCUMENT_ID) values (33692756,to_date('20-APR-12 15:17:02','DD-MON-RR HH24:MI:SS'),5336,265,1001,2,1,1,2,to_date('23-FEB-11 00:00:00','DD-MON-RR HH24:MI:SS'),1,62329,'MTVM_01001_120420.dat',150,1,457,0,'0',1,null,2,2,38597794,123456789,305419896,0,0,0,null,1,-1,356,null);
Insert into mtvm_op_replacement (ACCOUNTING_ID,RECORD_DATE,UNIVERSAL_SEQ,DAILY_SEQ,EQUIPMENT_ID,EQUIPMENT_MODEL_ID,STATION_ID,HALL_ID,POSITION,START_DATE,RECORD_VERSION,RECORD_OFFSET,DATA_FILE,SHIFT_NUMBER,USER_ID,OPERATION_SEQ,REASON_ID,SLIP_NUMBER,REFUND_LEVEL,PASS_ID,SUPPORT_TYPE_ID,SUPPORT_ID,CS_DATA_ID,OLD_SERIAL_NUMBER,NEW_SERIAL_NUMBER,REPLACEMENT_AMOUNT,DEPOSIT_AMOUNT,SUPPORT_AMOUNT,EXPIRATION_DATE,IS_IDENTIFIED,IDENTIFICATION_TYPE,COUNTRY_CODE,DOCUMENT_ID) values (33692757,to_date('20-APR-12 15:17:34','DD-MON-RR HH24:MI:SS'),5340,269,1001,2,1,1,2,to_date('23-FEB-11 00:00:00','DD-MON-RR HH24:MI:SS'),1,63483,'MTVM_01001_120420.dat',150,1,458,0,'0',1,null,2,2,38597796,305419896,50658,0,0,0,null,1,-1,356,null);
Insert into mtvm_op_replacement (ACCOUNTING_ID,RECORD_DATE,UNIVERSAL_SEQ,DAILY_SEQ,EQUIPMENT_ID,EQUIPMENT_MODEL_ID,STATION_ID,HALL_ID,POSITION,START_DATE,RECORD_VERSION,RECORD_OFFSET,DATA_FILE,SHIFT_NUMBER,USER_ID,OPERATION_SEQ,REASON_ID,SLIP_NUMBER,REFUND_LEVEL,PASS_ID,SUPPORT_TYPE_ID,SUPPORT_ID,CS_DATA_ID,OLD_SERIAL_NUMBER,NEW_SERIAL_NUMBER,REPLACEMENT_AMOUNT,DEPOSIT_AMOUNT,SUPPORT_AMOUNT,EXPIRATION_DATE,IS_IDENTIFIED,IDENTIFICATION_TYPE,COUNTRY_CODE,DOCUMENT_ID) values (33696304,to_date('23-APR-12 12:08:25','DD-MON-RR HH24:MI:SS'),5375,19,1001,2,1,1,2,to_date('23-FEB-11 00:00:00','DD-MON-RR HH24:MI:SS'),1,4274,'MTVM_01001_120423.dat',151,1,461,0,'0',1,null,2,2,38601351,1296,50658,0,0,0,null,1,-1,356,null);
Thanks in advance..

Similar Messages

  • Help needed in executing pl/sql programs

    hi all
    iam new to PL/SQL programming
    i have installed oracle 9i
    iam trying to practice some sample pl/sql programs
    i have opened oracle 9i and typed these commands
    sql>ed sum
    then a notepad opens where i type my pl/sql program and save it and then return back to oracle 9i and type this
    sql>@ sum
    then my pl/sql program gets executed.......but iam not getting any output
    its comig as procedure implemented succesfully
    is it compulsory to open notepad to execute pl/sql progams or we can direclty type the programs in oracle 9i
    please help in this matter ASAP
    Regards
    Suresh

    Yes, you can type the program directly at the SQL prompt, but editing will be a bit difficult.
    You should use some good editor that allows you to edit properly and then run like you did.
    You need to do:
    SQL> set serveroutput onbefore running your program to see dbms_output messages.

  • Help! PL/SQL Programming standards

    Hello,
    I need help from experienced developers urgently.
    I am in process of applying for new job and I have received two documents from my potential employer (software company).
    One document represents design and programming standards and other documents represents test PL/SQL package that is written according to those rules.
    My task is to analyze programming standards and send my opinion about correctness of those standards, whether they are according to current best practices or not, whether they represent current industrial standards in programming in general and specifically in PL/SQL programming and so on. I have already sent them my answer and I wish to estimate my chances of getting that job.
    Abstract from standard:
    1.     All variables and objects should be named according to their type (integer, varchar, character...etc) (sufix Hungarian notation)
    2.     All variables in PL/SQL should be prefixed with “v_” and written in camel case
    3.     SQL and PL/SQL built in functions should all be written in lower case.
    4.     All procedures should be prefixed with “pr_”
    5.     All functions should be prefixed with “fn_”
    6.     All packages should be sufixed with “_pkg”
    7.     View names should be prefixed with “v_”
    8.     All tables in Oracle schema should be prefixed with that schema name
    9.     Variables declared in package specification should be prefixed with “pksv_“
    10.     Variables declared in package body should be prefixed with “pkbv_“
    11.     Embeded SQL query in FOR LOOP statements should never be used because programm code is „dirty“ and unreadable.
    example:
    instead of : FOR v_User_Rec in (select * from all_users) LOOP...
    use:          FOR v_User_Rec in cursor_name LOOP...
    12.     Every query that retrieves more than 1000 rows should be optimized.
    13.     Font for writing code in PL/SQL Developer editor should be Arial and tabs should be used.
    I would appreciate replies from experienced PL/SQL developers especially those that have also experience in other programming languages.
    I have sent my answer to employer that programming standard is according to best practices and according to industry standard.
    I am worried a little about that Hungarian notation, is it still being used?
    If not when it was stopped being used?
    What are my chances of getting job?
    Would you hire a programmer that works according to those standards?
    Thanks.

    Hi,
    Welcome to the forum!
    924589 wrote:
    Hello,
    I need help from experienced developers urgently.
    I am in process of applying for new job and I have received two documents from my potential employer (software company).
    One document represents design and programming standards and other documents represents test PL/SQL package that is written according to those rules.
    My task is to analyze programming standards and send my opinion about correctness of those standards, whether they are according to current best practices or not, whether they represent current industrial standards in programming in general and specifically in PL/SQL programming and so on. I have already sent them my answer and I wish to estimate my chances of getting that job.There is no agreement about what the "best practice" is. I'm sure you'll see that as soon as you have 2 replies. I'll tell you what I use and how strictly I do it, what I find useful, and what other experienced programmers seem to do, in my experience.
    Abstract from standard:
    1.     All variables and objects should be named according to their type (integer, varchar, character...etc) (sufix Hungarian notation)I use suffixes that show, not only the data type, but how the variable is being used. Fo example, abbr means an abbreviation (something that reminds you of the full spelling), cd means a code (something that does not necessarily resemble its meaning), name is a complete name (not abbreviated or coded).  These are all VARCHAR2 types.  (Actually, cd may be a NUMBER.) I do this for maybe 25% of the variables I use in production code, when I think confusion with other variables, or doubts about the meaning, would be likely. For column names in tables, I might do it more than 50% of the time. Many people don't bother at all.
    2.     All variables in PL/SQL should be prefixed with “v_” and written in camel caseI don't know of any experieced programmers who always use v_. Maybe 1 out of 4 programmers use CamelCase. I use lower case myself in PL/SQL. In languages where names are case-sensitive, this is much more important. I use CamelCase all the time when I program in PostScript.
    3.     SQL and PL/SQL built in functions should all be written in lower case.I do almost exactly the opposite: I put keywords and built-in funtions in UPPER case, and I find it very helpful. A lot of experienced programmers do the same, though some use lower case, and a few don't follow any pattern.
    4.     All procedures should be prefixed with “pr_”
    5.     All functions should be prefixed with “fn_”I don't know anybody who does 4 or 5, or anything like them.
    6.     All packages should be sufixed with “_pkg”
    7.     View names should be prefixed with “v_”Some people do 6 and 7, or something similar.
    8.     All tables in Oracle schema should be prefixed with that schema nameI never seen this. If you want to clarify who owns a table, you can explictly give the owner name, e.g. scott.emp.
    9.     Variables declared in package specification should be prefixed with “pksv_“
    10.     Variables declared in package body should be prefixed with “pkbv_“I've never seen 9 or 10 done, but I can see why somebody might find it helpful.
    11.     Embeded SQL query in FOR LOOP statements should never be used because programm code is „dirty“ and unreadable.
    example:
    instead of : FOR v_User_Rec in (select * from all_users) LOOP...
    use:          FOR v_User_Rec in cursor_name LOOP...It's often unnecessary, and it can be more efficient to combine them. Sometimes it simply isn't possible.
    If code gets difficult to read, it's often because it's not being modularized properly.
    12.     Every query that retrieves more than 1000 rows should be optimized.Every query (and other statement) should be optimized, regardless of how many rows it retrieves. How much time you spend optimizing any one query depends on several factors. How often the query is done, and the table sizes are more important than how many rows will be returned.
    13.     Font for writing code in PL/SQL Developer editor should be Arial and tabs should be used.I find a fixed-width font, such as Courier, is much more convenient.
    Whitespace, including tabs, should definitely be used.
    I would appreciate replies from experienced PL/SQL developers especially those that have also experience in other programming languages.
    I have sent my answer to employer that programming standard is according to best practices and according to industry standard.
    I am worried a little about that Hungarian notation, is it still being used?
    If not when it was stopped being used?
    What are my chances of getting job? Either I'm on the committee that's deciding, and therefore can't tell you, or I'm not, and therefore I don't know.
    Would you hire a programmer that works according to those standards?Sure. I'd also hire programmers who preferred other standards, or didn't care about some of the items above.

  • Calling Transaction Import Concurrent Program in PL/SQl program

    Hi,
    I am trying to run Transaction Import process by calling the concurrent program in my pl/sql program.I think I am passing all the right paramters which are necessary.But the actual PAXTRTRX is never being called and I am not getting any request ID back.No exception is being thrown.Following is how I am calling the concurrent program...
    p_tran_imp_request_id := fnd_request.submit_request
         ( application => 'PA'     
              , program => 'PAXTRTRX'
              , sub_request => FALSE
              , argument1 => 'My Transaction Source name here'
              , argument2 => 'My batch name here'
    ,argument3 => 'my TXN_INTERFACE_ID here'
    If I run the PRC: Transaction Import from front end...the process is run and import was completed just fine.But I am not able to call concurrent program from my program.Is there anything I am missing...Is there any thing I need to do before I call the concurrent program...
    Any help in this issue is greatly appreciated.
    Thanks

    Hi,
    Thanks for the advise. Yes I was calling the initialize function but I was passing wrong application id and responsibility id to that.Now that is taken care of.
    Thanks

  • PL/SQL program not working when connect database via SqlNet

    Hi,
    This is a segment of a PL/SQL program before opening a cursor using input descriptor. It is working fine ( to get the value of unOutputCount ) without connect to a database via SqlNet, can anyone tell me why it is not working ( unOutputCount return 0)while connecting to a database via SqlNet and how to make it work without opening a cursor before DESCRIBE OUTPUT ...?
    EXEC SQL ALLOCATE DESCRIPTOR GLOBAL 'input_111'
    WITH MAX 100;
    EXEC SQL ALLOCATE DESCRIPTOR GLOBAL 'output_111'
    WITH MAX 100;
    EXEC SQL PREPARE STMT1 FROM :psSqlStatement;
    EXEC SQL DECLARE CURSOR1 CURSOR FOR STMT1;
    EXEC SQL DESCRIBE INPUT STMT1
    USING DESCRIPTOR GLOBAL 'input_111';
    /* Get count of input parameters in statement */
    EXEC SQL GET DESCRIPTOR GLOBAL 'input_111' :unInputCount = COUNT;
    EXEC SQL DESCRIBE OUTPUT STMT1
    USING DESCRIPTOR GLOBAL 'output_111';
    /* Get count of output parameters in statement */
    EXEC SQL GET DESCRIPTOR GLOBAL 'output_111'
    :unOutputCount = COUNT;

    Hi,
    Welcome to Oracle OTN Forums!
    I changed your code a little. I think this help you
    CREATE OR REPLACE
    PROCEDURE xx_test
    IS
      v_pid VARCHAR2(100);
      v_cn  VARCHAR2(100);
      v_id  VARCHAR2(1000);
      v_val VARCHAR2(1000);
      CURSOR C1
      IS
        (SELECT product_id, 'PRODUCT_ID'  cn
            FROM product1 );
      BEGIN
        FOR V1 IN C1
        LOOP
          FETCH C1 INTO v_pid, v_cn;
          dbms_output.put_line('==== '||v_pid||'==== '||v_cn);
          EXECUTE IMMEDIATE
          'SELECT product_id, DECODE(COUNT (product_id),1,MAX (product_id))||'''||V_CN||''' as val
            FROM product1
           WHERE product_id =:a
           GROUP BY product_id)' INTO v_id, v_val USING v_pid;
          dbms_output.put_line('==== '||v_id||'==== '||v_val);
          EXECUTE IMMEDIATE 'UPDATE product2 SET '||v_cn||' = ' ||''''|| v_val ||''''|| ' WHERE product_id = :b' USING v_pid;
          dbms_output.put_line('++++ '||v_cn||'++++ '||v_val||'++++ '||v_pid);
        END LOOP;
      END xx_test;

  • REP-1419: 'beforereport': PL/SQL program aborted.

    Hi,
    We transmitted a payment batch file to one of our Banks (via FTP). First time it failed because our Bank ftp details were changed overnight and the folder where we transfer the file (via PGP) is missing. Now the Bank has recreated the directory and gave full access to transmit the file. After getting the intimation from the Bank, we cancelled our Payment Batch program and resubmitted the Payment batch once again. However, this time the Payment Batch is ending at Format stage itself. And throwing the above error < REP-1419: 'beforereport': PL/SQL program aborted.>
    Now I do not know why the formatting is failing when all directories are exisiting and have full access ? Do we need to revalidate the already validated and approved invoices? Do we need to delete the earlier file that was created in the morning?
    Can anyone throw some light on this?
    I appreciate your help.
    (PS: all other information including, vendor, vendor sites, bank, pay group and etc are all fine)

    check the code in reports before parameter form.
    May be the related objects are not there. You can try opening this report in the new version and compile the before parameter form trigger
    Rajesh Alex

  • What are the best books to purchase for pl/sql programming?

    What are the best books to purchase for pl/sql programming?
    I am new to this field and I am looking for the best books to help me in pl/sql programming. Can someone please suggest?
    Thanks

    In my opinion one of the best to start
    Oracle PL/SQL Programming, Third Edition
    Steven Feuerstein

  • Which PL/SQL developer tool is best to develop the PL/SQL program?

    Hi, all, who know which PL/SQL developer tool is best to develop the PL/SQL program? it is jdeveloper or designer or third party developer tool? please let me know, Thanks!

    To be honest , I have been using only Notepad or
    a simple Textpad ..to this date.
    While these tools may be of help in indenting and beautification of code, I feel you lose your debugging skills and forget the SQL-PL/SQL syntax with them.
    Cheers
    Ashwin N.

  • Shell script calling SQL Program and passing parameters

    Hi guys,
    Greetings from Toronto. Is it possible to pass a string or strings as parameters to a sql program from a shell script ?
    Shell Script
    # Accept system input parameters
    p_user_id=$1
    p_job_id=$2
    sqlplus.exe -s $p_user_id @$RD_PATH/rd_test.sql $p_user_id $p_job_id
    SQL Program (rd_test.sql)
    -- Accept system input parameters
    define p_user_id = &1
    define p_job_id = &2
    -- Wondering if its possible to pass these 3 parameters from a shell script program.
    -- (1) rd_test-$p_job_id-3-1.lis
    -- (2) RD_PRINTER(rd_test,3)
    -- (3) t_data
    select
    t_data=''rd_test-'||'''$p_job_id'''||'-1-1.txt''
    t_data_dir=''.''
    ksh $RD_PATH/another_shell_prog.sh $p_user_id $p_job_id '||a.rd_value||' '
    ||b.rd_value||' rd_test-$p_job_id-3-1.lis $RD_PRINTER(rd_test,3) '||
    '$t_data $t_data_dir'||'
    exit_status=$?
    check_command'
    from rd_job_parameter b, rd_job_parameter a
    where a.job_id = &2
    and a.jp_module_id = 'RDTEST'
    and b.job_id = a.job_id
    and b.module_id = a.module_id
    /As always, its not something I have to solve this minute. Any help would be appreciated
    and I will be thinking of the problem.
    Thanks
    Raj
    Edited by: Raj404261 on Jun 25, 2009 11:40 AM
    Edited by: Raj404261 on Jun 25, 2009 5:29 PM

    Hi Sean,
    Thanks for the reply. I am not at work yet. I already do have the if condition to call 2 separate sql scripts. I was hoping them to be reduced to one sql script. That's why I was hoping to pass some of those values to the select statement as parameters.
    Here is what I was hoping to pass from the shell script based on an IF condition. The good thing about it is that I can hard code these 3 parameters in the shell script in the IF and ELSE conditions. Is it possible to tag these 3 hard coded values in the command line after $p_job_id and then capture these 3 parameters in the SQL program ?
    1. rd_test-$p_job_id-3-1.lis or rd_test-$p_job_id-3-1.lis
    2. RD_PRINTER(rd_test,3) or RD_PRINTER(rd_test,4)
    3. t_data=''rd_test-'||'''$p_job_id'''||'-1-1.txt''
    Shell script :
    # Accept system input parameters
    p_user_id=$1
    p_job_id=$2
    if [condition]
       sqlplus.exe -s $p_user_id @$RD_PATH/rd_test.sql $p_user_id $p_job_id
    else
       sqlplus.exe -s $p_user_id @$RD_PATH/rd_test.sql $p_user_id $p_job_id
    fi
    ksh $RD_PATH/another_shell_prog.sh $p_user_id $p_job_id '||a.rd_value||' '
    ||b.rd_value||' rd_test-$p_job_id-3-1.lis $RD_PRINTER(rd_test,3) '||
    '$t_data $t_data_dir'||'

  • Does ODI has the ability to organize 1000+ pl/sql programs?

    Hi experts,
    we are proposing ODI to a customer who has 1000+ pl/sql programs to load data to Oracle DW. Besides, there are many complicated dependencies among these programs.
    I know that ODI has "package" functionality to build up a workflow and schedule programs like mappings and pl/sql etc... But does ODI have the ability to organize 1000+ of them? And does ODI provide a way like scripting to automatically generate this package? I mean something like Teradata's ETL Automation if anybody ever used this.
    Any help will be highly appreciated.
    Flo

    Hi Flo,
    I can't see a way to conver the PL/SQL code to ODI "code" (interface, procedures, etc...) directly but, it is possible to customize an object to read the database PL/SQL dependence and generate a package that call those codes in the right sequence.
    An other way, that will bring you all Metadata control (column using information thu all database) is use a customized KM to map the pl/sql programs as table and, then use it in a interface.
    Cezar Santos

  • OWB 9.0.4: dbms_awm.refresh_awcube  ORA-06501: PL/SQL: program error

    While running the following PL/SQL generated by OWB/OLAP bridge using OWB 9.0.4, I get the PL/SQL program error
    PL/SQL:
    begin
    dbms_awm.create_awcube (USER, 'BIBDEMO_STKPRICE_CUBE', USER, 'BIBDEMO_AW', 'AW_BIBDEMO_STKPRICE_CUBE');
    begin
    dbms_awm.create_awcubeload_spec ('BIBDEMO_STKPRICE_CUBE', USER, 'BIBDEMO_STKPRICE_CUBE', 'LOAD_DATA');
    exception when others then null;
    end;
    dbms_awm.refresh_awcube (USER, 'BIBDEMO_AW', 'AW_BIBDEMO_STKPRICE_CUBE', 'BIBDEMO_STKPRICE_CUBE');
    exception when others then cwm_utility.dump_error(); raise program_error;
    end;
    ERROR:
    ERROR at line 1:
    ORA-06501: PL/SQL: program error
    ORA-06512: at line 4
    ORA-06510: PL/SQL: unhandled user-defined exception
    fyi: I am using Oracle9i with 9.2.0.3 patch
    The DBMS_AW statement to create/populate the dimesntions works fine
    Here is the PL/SQL for the dimensions
    begin
    dbms_awm.create_awdimension (USER, 'STOCK', USER, 'BIBDEMO_AW', 'AW_STOCK');
    begin
    dbms_awm.create_awdimload_spec ('STOCK', USER, 'STOCK', 'FULL_LOAD');
    exception when others then null;
    end;
    dbms_awm.refresh_awdimension (USER, 'BIBDEMO_AW', 'AW_STOCK', 'STOCK');
    dbms_awm.create_awdimension (USER, 'DAY', USER, 'BIBDEMO_AW', 'AW_DAY');
    begin
    dbms_awm.create_awdimload_spec ('DAY', USER, 'DAY', 'FULL_LOAD');
    exception when others then null;
    end;
    dbms_awm.refresh_awdimension (USER, 'BIBDEMO_AW', 'AW_DAY', 'DAY');
    dbms_awm.create_awdimension (USER, 'STKMEAS', USER, 'BIBDEMO_AW', 'AW_STKMEAS');
    begin
    dbms_awm.create_awdimload_spec ('STKMEAS', USER, 'STKMEAS', 'FULL_LOAD');
    exception when others then null;
    end;
    dbms_awm.refresh_awdimension (USER, 'BIBDEMO_AW', 'AW_STKMEAS', 'STKMEAS');
    exception when others then cwm_utility.dump_error(); raise program_error;
    end;
    I am just trying the recreate the BIBDEMO_STKPRICE_CUBE in analytical workspace. Would be helpful if someone could send me the complete PL/SQL for creating the analytical workspace and views for this cube using DBMS_AW package.
    Thanks
    Panneer

    Panneer,
    Unfortunately you will need a patch on top of database version 9.2.0.3 in order to make this functionality work. This patch has not been released yet, but is currently in QA. We are hoping that the patch will be available in June. Stay tuned...
    Thanks,
    Mark.

  • How do I submit a concurrent request (for PL/SQL program)   from RDF

    Hi,
    I have a requirement i need to call a PL/SQL program using concurrent request from Oracle RDF, I am using below code.
    -> PL/SQL program has two input parameters
    Case:- 1
    reqid :=
    fnd_request.submit_request ('SQLAP','IPCS_ACH_VENDOR_PAYMENT1','','', FALSE,
                   :P_PAYMENT_BATCH,'N' , '', '' ,
    If i ran the above rdf i am getting below errors from concurrent request log
    ORACLE error 6550 in FDPSTP
    Cause:  FDPSTP failed due to ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'GEN_ACH'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Case :- 2
    reqid :=
    fnd_request.submit_request ('SQLAP','IPCS_ACH_VENDOR_PAYMENT1','','', FALSE,
                   :P_PAYMENT_BATCH,'N' );
    -> Able to compile the report without any errors.
    -> Upon running the rdf getting below error messages
    REP-0736: There exist uncompiled program unit(s).
    REP-1247: Report contains uncompiled PL/SQL.
    => Case:1 very well worked for Host file .
    --- Please help me how to submit a concurrent program( PL/SQL with 2 paramerers) in RDF ...
    Thanks
    Edited by: Apps Beginer on Dec 2, 2009 1:40 PM

    Looking at the 11.5.10 version of the [Oracle Applications Developer's Guide|http://download.oracle.com/docs/cd/B25516_18/current/html/docset.html] on page 21-32 - it states that the FND_REQUEST function must know information about the user and responsibility that is submitting the request. Therefore, the function only works from concurrent programs or forms within Oracle Applications. There are ways around this by initializing this information in your session before your call to SUBMIT_REQUEST. I've never tried this from a Report, but I've done it from PL/SQL that executes outside of Apps. You could try the following to see if it works.
    DECLARE
         n_RESP_APPL_ID          NUMBER;
         n_RESP_ID          NUMBER;
         n_USER_ID          NUMBER;
         n_REQUEST_ID          NUMBER;
    BEGIN
         n_RESP_APPL_ID := apps.FND_PROFILE.VALUE('RESP_APPL_ID');
         n_RESP_ID := apps.FND_PROFILE.VALUE('RESP_ID');
         n_USER_ID := apps.FND_PROFILE.VALUE('USER_ID');
         apps.FND_GLOBAL.Apps_Initialize(n_USER_ID, n_RESP_ID, n_RESP_APPL_ID);
         /* I prefer to use Named Notation for this call rather than enter placeholders for all 100+ parameters to SUBMMIT_REQUEST */
         n_REQUEST_ID := apps.fnd_request.submit_request(
                                       application => 'SQLAP',
                                       program => 'IPCS_ACH_VENDOR_PAYMENT1',
                                       start_time => To_Char(sysdate,'DD-MON-YYYY',
                                       argument1 => :P_PAYMENT_BATCH
                                       );Obviously, I don't know all of the parameters you need for your request, so I made a "BEST GUESS" based on your code sample so I doubt my example call to Submit_Request will work if you Copy-N-Paste. Make sure you use the correct parameters when you try this in your report.
    Hope this helps.
    Craig...
    If a response is helpful or correct, please mark it accordingly

  • PL/SQL Program for automation

    Hi All,
    I want to write a Pl/sql program for the following requirement.
    1. wnat to connect to remote desktop .
    2. There we can find one more DB like AS-access. This one contains one file( ltake it as "XYZ" i)n some particular path.
    3. want to save this file in share folder.
    4. this share folder contains some "abc.txt" file.
    5.want to replace the data which XYZ contains.
    6. It is already having one ".XLS" file in share folder. want to delete it. ( because while running the exporting data the ".XLS" file created daily)
    7. now in share folder we have one ".mdb" file.If we click on that it will ask like "create Report"," Exit".
    8. we should click on "Create Report"
    9.then one pop up will come like "All the exisiting data will be lost",then press "OK"
    10. Again one window will open. It contains 2 buttopns. 1. Import Data 2. Export data.
    11.Click on Import data. Then it will ask for "Password"
    12.After giving the password it will import the whole data. ( It's taking around Hr time)
    13. After that one pop up will come says " Import completed". then press OK and then click on "Export data"
    14.After clicking this it will generate ".xls" file in share folder.
    15. after that open that ".XLS" file and then Goto Tools --> Macros --> Macros, to run the Macros from Excel sheet.
    16. Run the macro - "PERSONAL.XLS!macNewEFG".
    17.Once done, save the ".xls" as "Report - <Month 'YY>.xls" in share folder.
    18.Send then this generated report to respective mail-ids automatically.
    daily manually we are doing this job. But I am planning to do it automatically.
    so can any one please give me ur suggestions fir this.
    Thanks in adv.

    Hi,
    thanks for your quick response.Can you please suggest me how to write a shell script for this .
    I hope this is not the correct place to ask this.But please help me out regarding this.
    Thank you.

  • How to create and execute PL/SQL program or Procedure from Java (JDBC)

    hi all,
    user will enter the Pl/Sql program from User-Interface. that program has to be create in DB and execute that.
    due to some confusions, how to execute this from Java, i (user) entered the same logic through a Procedure.
    my Java code is
    Statement st = con.createStatement();
    Statement.execute(procedure_query); // procedure name is myPro
    CallableStatement cs = con.prepareCall("{call myPro}");
    (as given in SUN docs - http://java.sun.com/docs/books/tutorial/jdbc/basics/sql.html)
    but its not creating the procedure.
    and i tried to run a procedure (which is already created) with CallableStatement, and this is also not working.
    how to get this.
    thanks and regards
    pavan

    Hi,
    SInce the PL/SQL block is keyed in dynamically, you probably want to use the anonymous PL/SQL syntax for invoking it:
    // begin ? := func (?, ?); end; -- a result is returned to a variable
    CallableStatement cstmt3 =
    conn.prepareCall(“begin ? := func3(?, ?); end;”);
    // begin proc(?, ?); end; -- Does not return a result
    CallableStatement cstmt4 =
    Conn.prepareCall(“begin proc4(?, ?); end;”);
    SQLJ covered in chapter 10, 11, and 12 of my book furnish a more versatile dynamic SQl or PL/SQL mechanisms.
    Kuassi
    - blog http://db360.blogspot.com/
    - book http://db360.blogspot.com/2006/08/oracle-database-programming-using-java_01.html

  • WebADI: How to find out which integrator executed the upload PL/SQL program

    Hi,
    I understand that we can create a integrator to upload data to EBS and execute a PL/SQL program.
    Is there any way to find out which INTEGRATOR executed this PL/SQL program?
    Thanks.
    Regards

    Alternatively:
    select name, plsql_debug from sys.all_plsql_object_settings

Maybe you are looking for

  • Black Screen with mouse cursor

    Hello We are an enterprise organization with staffs logging in to their systems using domain username and password. For some of our users having Windows 7 as OS, when they log in with their domain credentials a blank screen appears with movable mouse

  • How do i put files on the 30 gb video

    i try to put files on but all it says is some weird stuff

  • SQL question - please help!

    Hi, I am working on a SQL, please help ms with the question below .... thanks (1)Increase by 10% salary of these captain pilots who have traveled more than 800,000 miles. Routes | | Flights | |Pilots | | | | | | #routeID | | #flightNO | |#pilotID | d

  • How do you empty mail "In" directory all at once??

    How do you delete all entries in the mail In directory all at once, rather than one-by-one? I can flag them all and mark them as read, but I cant determine how to delete them. Maybe it cant be done. Many thanks

  • What is the webroot/firefox 5.0 conflict?

    ''locking as a duplicate - https://support.mozilla.com/en-US/questions/855602'' I am continually prompted to updae my 4.0.1 v of Firefox w 5.0. When I attempt to do that, I receive a message about a possible conflice with my Webroot security software