Need help in procedure
Hi Experts,
I have wrote a procedure which is being fired by a trigger and update or insert the Attendance_day table on the basis of punch string, the below issue is coming when employee do two regular shift.
[code]
select * from ATTENDANCEMASTER where DATE_PUNCH>='01-aug-2013' and EMP_CD in('E03497');
SNO
EMP_CD
DATE_PUNCH
TIME_PUNCH
PREFIX
INOUT
8027551423
E03497
1-Aug-13
8:53
200
I
8027890076
E03497
1-Aug-13
19:01
200
O
8027980116
E03497
2-Aug-13
8:56
200
I
8028070441
E03497
2-Aug-13
17:43
200
O
8028071247
E03497
3-Aug-13
8:49
200
I
8028160480
E03497
3-Aug-13
17:43
200
O
8028160680
E03497
3-Aug-13
22:51
200
I
8028161035
E03497
4-Aug-13
6:54
200
O
8028661326
E03497
6-Aug-13
8:51
200
I
8028840273
E03497
6-Aug-13
18:55
200
O
8028841247
E03497
7-Aug-13
8:56
200
I
This table is being updated after employees swipe the card. If u look @ the record of 3rd aug the employee has done two shift 1st in 1st shift(9-6pm) and another on 3rd shift (11pm-to next day of 7am). After this table the main attendnace_day table is being updated
SELECT * FROM ATTENDANCE_DAY WHERE EMP_CODE IN('E03497') AND ATTD_DATE >='01/AUG/2013';
attd_date
emp_code
in_time
out_time
status
shift
day_no
chg_date
chg_user
chg_term
result
punch_str
1-Aug-13
E03497
8:53
19:01
(null)
G0013
5
1-Aug-13
STAR
PAPNABMS
-08:53 , -19:01
2-Aug-13
E03497
8:56
17:43
(null)
G0013
6
2-Aug-13
STAR
PAPNABMS
-08:56 , -17:43
3-Aug-13
E03497
8:49
17:43
(null)
G0013
7
4-Aug-13
PRITESH
21PAPNADIXIT
-08:49 , -17:43 , -22:51,*-17:43
6-Aug-13
E03497
8:51
18:55
(null)
G0013
3
6-Aug-13
STAR
PAPNABMS
-08:51 , -18:55
7-Aug-13
E03497
8:56
G0013
4
7-Aug-13
STAR
PAPNABMS
0
The out time in aug 3rd record is 17:43 but as employee has done two shifts the out time must be:
8028161035
E03497
4-Aug-13
6:54
200
O
That's why I need to change the procedure in way that it should update the attendance_day table on the basis of IN OUT flag and must capture these types of records properly.
The Procedure is mentioned below:
[code]
CREATE OR REPLACE
PROCEDURE UPDATE_ATTENDANCE
AS_EMP_CODE CHAR,
AS_DATE_PUNCH DATE,
AS_TIME_PUNCH CHAR
AS
BEGIN
DECLARE
a_time_punch workshft.in_time%type := AS_TIME_PUNCH;
a_work_shift employee.work_shift%type;
a_shift_intime workshft.in_time%type;
a_lunch_time workshft.lunch_time%type;
a_hol_tblno holiday.hol_tblno%type;
a_fin_entity site.fin_entity%type;
a_prv_date DATE := AS_DATE_PUNCH - 1;
a_count NUMBER(5);
a_count1 NUMBER(5);
CURSOR c1
IS
SELECT work_shift
FROM
(SELECT tran_date eff_date,
work_shift_o work_shift,
conf_date,
chg_date
FROM employee_det_change
WHERE emp_code = AS_EMP_CODE
AND tran_date > AS_DATE_PUNCH
AND status = 'C'
UNION ALL
SELECT eff_Date,
work_shift__fr work_shift,
conf_date,
chg_date
FROM emp_employ_events
WHERE emp_code = AS_EMP_CODE
AND eff_date > AS_DATE_PUNCH
AND confirmed = 'Y'
ORDER BY eff_date,
conf_date,
chg_date;
BEGIN
SELECT b.fin_entity
INTO a_fin_entity
FROM employee a,
site b
WHERE a.emp_code = AS_EMP_CODE
AND b.site_code = a.work_site;
SELECT COUNT(*)
INTO a_count
FROM work_shift
WHERE emp_code = AS_EMP_CODE
AND AS_DATE_PUNCH BETWEEN from_dt AND to_dt;
IF (a_count > 0) THEN
SELECT shift
INTO a_work_shift
FROM work_shift
WHERE emp_code = AS_EMP_CODE
AND AS_DATE_PUNCH BETWEEN from_dt AND to_dt;
ELSE
FOR i IN c1
LOOP
a_work_shift := i.work_shift;
EXIT;
END LOOP;
IF (a_work_shift IS NULL) THEN
SELECT work_shift
INTO a_work_shift
FROM employee
WHERE emp_code = AS_EMP_CODE;
END IF;
END IF;
SELECT in_time,
lunch_time
INTO a_shift_intime,
a_lunch_time
FROM workshft
WHERE shift = a_work_shift
AND day_no = TO_CHAR(AS_DATE_PUNCH,'D');
SELECT COUNT(*)
INTO a_count
FROM attendance_day
WHERE attd_date = AS_DATE_PUNCH
AND emp_code = AS_EMP_CODE;
IF (a_count > 0) THEN
IF (A_FIN_ENTITY IN ('IC','HU')) THEN
------UPDATE HERE-----
UPDATE attendance_day
SET out_time = a_time_punch,
punch_str = punch_str || ' , -' || AS_TIME_PUNCH,
work_hour = (ddf_time_in_mm(a_time_punch)-ddf_time_in_mm(in_time))
WHERE attd_date = AS_DATE_PUNCH
AND emp_code = AS_EMP_CODE;
ELSE
IF (ddf_time_in_mm(a_time_punch) < (ddf_time_in_mm(a_shift_intime) + 30)) THEN
UPDATE attendance_day
SET PUNCH_STR = PUNCH_STR || ' , -' || AS_TIME_PUNCH
WHERE attd_date = AS_DATE_PUNCH
AND emp_code = AS_EMP_CODE;
ELSE
------UPDATE HERE-----
UPDATE attendance_day
SET out_time = a_time_punch,
punch_str = punch_str || ' , -' || AS_TIME_PUNCH,
work_hour = (ddf_time_in_mm(a_time_punch)-ddf_time_in_mm(in_time))
WHERE attd_date = AS_DATE_PUNCH
AND emp_code = AS_EMP_CODE;
END IF;
END IF;
ELSE
SELECT COUNT(*)
INTO a_count1
FROM work_shift
WHERE emp_code = AS_EMP_CODE
AND a_prv_date BETWEEN from_dt AND to_dt
AND shift =
(SELECT shift
FROM workshft
WHERE shift = work_shift.shift
AND day_no = TO_CHAR(a_prv_date,'D')
AND (out_time > '24:00'
OR out_time < in_time)
SELECT ddf_get_holtblno(AS_EMP_CODE,AS_DATE_PUNCH) INTO a_hol_tblno FROM dual;
SELECT COUNT(*)
INTO a_count
FROM holiday
WHERE hol_tblno = a_hol_tblno
AND hol_date = AS_DATE_PUNCH;
IF ((A_COUNT1 > 0) OR (DDF_TIME_IN_MM(A_TIME_PUNCH) < (DDF_TIME_IN_MM(A_SHIFT_INTIME) - 120)) OR (A_COUNT > 0)) THEN
IF (a_fin_entity IN ('IC','HU') AND a_count1 > 0) THEN
SELECT COUNT(*)
INTO a_count
FROM attendance_day a,
workshft b
WHERE a.attd_date = a_prv_date
AND a.emp_code = AS_EMP_CODE
AND b.shift = a.shift
AND b.day_no = a.day_no
AND (ddf_time_in_mm(a_time_punch)+1440) <= (ddf_time_in_mm(b.out_time) + (
CASE
WHEN b.out_time < b.in_time
THEN 1440
ELSE 0
END) + 300);
ELSE
SELECT COUNT(*)
INTO a_count
FROM attendance_day
WHERE attd_date = a_prv_date
AND emp_code = AS_EMP_CODE
AND out_time IS NULL;
END IF;
IF (a_count > 0) THEN
A_TIME_PUNCH := TO_CHAR((TO_NUMBER(SUBSTR(A_TIME_PUNCH,1,2))+24)) || ':' || SUBSTR(A_TIME_PUNCH,4,2);
------UPDATE HERE-----
UPDATE attendance_day
SET out_time = a_time_punch,
punch_str = punch_str
|| ' , -'
|| a_time_punch,
work_hour = (ddf_time_in_mm(a_time_punch)-ddf_time_in_mm(in_time))
WHERE attd_date = a_prv_date
AND emp_code = AS_EMP_CODE;
ELSE
------UPDATE HERE-----
INSERT
INTO attendance_day
attd_date,
emp_code,
in_time,
shift,
day_no,
chg_date,
chg_user,
chg_term,
punch_str,
lunch_time
VALUES
AS_DATE_PUNCH,
AS_EMP_CODE,
a_time_punch,
a_work_shift,
TO_CHAR(AS_DATE_PUNCH,'D'),
sysdate,
USER,
userenv('terminal'),
|| AS_TIME_PUNCH,
a_lunch_time
END IF;
ELSE
INSERT
INTO attendance_day
attd_date,
emp_code,
in_time,
shift,
day_no,
chg_date,
chg_user,
chg_term,
punch_str,
lunch_time
VALUES
AS_DATE_PUNCH,
AS_EMP_CODE,
a_time_punch,
a_work_shift,
TO_CHAR(AS_DATE_PUNCH,'D'),
sysdate,
USER,
userenv('terminal'),
'-' || AS_TIME_PUNCH,
a_lunch_time
END IF;
END IF;
END;
END;
[code]
Thnx in advance, help will be appreciated..
Sorry, totally lost in procedural logic (maybe others could see some ways of improvement)
PROCEDURE UPDATE_ATTENDANCE
AS_EMP_CODE CHAR,
AS_DATE_PUNCH DATE,
AS_TIME_PUNCH CHAR
AS
BEGIN
DECLARE
a_time_punch workshft.in_time%TYPE := AS_TIME_PUNCH;
a_work_shift employee.work_shift%TYPE;
a_shift_intime workshft.in_time%TYPE;
a_lunch_time workshft.lunch_time%TYPE;
a_hol_tblno holiday.hol_tblno%TYPE;
a_fin_entity site.fin_entity%TYPE;
a_prv_date DATE := AS_DATE_PUNCH - 1;
a_count NUMBER(5);
a_count1 NUMBER(5);
-------------------------------changes 13082013 starts-------------------
a_count11 workshft.in_time%TYPE;
a_count22 workshft.in_time%TYPE;
-------------------------------changes 13082013 ends-------------------
CURSOR c1 IS
SELECT work_shift
FROM(SELECT tran_date eff_date,work_shift_o work_shift,conf_date,chg_date
FROM employee_det_change
WHERE emp_code = AS_EMP_CODE
AND tran_date > AS_DATE_PUNCH
AND status = 'C'
UNION ALL
SELECT eff_date,work_shift__fr work_shift,conf_date,chg_date
FROM emp_employ_events
WHERE emp_code = AS_EMP_CODE
AND eff_date > AS_DATE_PUNCH
AND confirmed = 'Y'
ORDER BY eff_date,conf_date,chg_date;
BEGIN
SELECT b.fin_entity
INTO a_fin_entity
FROM employee a,
site b
WHERE a.emp_code = AS_EMP_CODE
AND b.site_code = a.work_site;
SELECT COUNT(*)
INTO a_count
FROM work_shift
WHERE emp_code = AS_EMP_CODE
AND AS_DATE_PUNCH BETWEEN from_dt AND to_dt;
IF (a_count > 0) THEN
SELECT shift
INTO a_work_shift
FROM work_shift
WHERE emp_code = AS_EMP_CODE
AND AS_DATE_PUNCH BETWEEN from_dt AND to_dt;
ELSE
FOR i IN c1
LOOP
a_work_shift := i.work_shift;
EXIT;
END LOOP;
IF (a_work_shift IS NULL) THEN
SELECT work_shift
INTO a_work_shift
FROM employee
WHERE emp_code = as_emp_code;
END IF;
END IF;
SELECT in_time,lunch_time
INTO a_shift_intime,a_lunch_time
FROM workshft
WHERE shift = a_work_shift
AND day_no = TO_CHAR(AS_DATE_PUNCH,'D');
SELECT COUNT(*)
INTO a_count
FROM attendance_day
WHERE attd_date = AS_DATE_PUNCH
AND emp_code = AS_EMP_CODE;
IF (a_count > 0) THEN
IF (a_fin_entity IN ('IC','HU')) THEN
UPDATE attendance_day
SET out_time = a_time_punch,
punch_str = punch_str || ' , -' || as_time_punch,
work_hour = (ddf_time_in_mm(a_time_punch) - ddf_time_in_mm(in_time))
WHERE attd_date = AS_DATE_PUNCH
AND emp_code = AS_EMP_CODE;
ELSE
IF (ddf_time_in_mm(a_time_punch) < (ddf_time_in_mm(a_shift_intime) + 30)) THEN
UPDATE attendance_day
SET punch_str = punch_str || ' , -' || as_time_punch
WHERE attd_date = AS_DATE_PUNCH
AND emp_code = AS_EMP_CODE;
ELSE
UPDATE attendance_day
SET out_time = a_time_punch,
punch_str = punch_str || ' , -' || as_time_punch,
work_hour = (ddf_time_in_mm(a_time_punch) - ddf_time_in_mm(in_time))
WHERE attd_date = AS_DATE_PUNCH
AND emp_code = AS_EMP_CODE;
END IF;
END IF;
ELSE
SELECT COUNT(*)
INTO a_count1
FROM work_shift
WHERE emp_code = AS_EMP_CODE
AND a_prv_date BETWEEN from_dt AND to_dt
AND shift = (SELECT shift
FROM workshft
WHERE shift = work_shift.shift
AND day_no = TO_CHAR(a_prv_date,'D')
AND (out_time > '24:00' OR out_time < in_time)
SELECT ddf_get_holtblno(as_emp_code,as_date_punch)
INTO a_hol_tblno
FROM dual;
SELECT COUNT(*)
INTO a_count
FROM holiday
WHERE hol_tblno = a_hol_tblno
AND hol_date = AS_DATE_PUNCH;
IF ((a_count1> 0) OR (ddf_time_in_mm(a_time_punch) < (ddf_time_in_mm(a_shift_intime) - 120)) OR (a_count > 0)) THEN
IF (a_fin_entity IN ('IC','HU') AND a_count1 > 0) THEN
SELECT COUNT(*)
INTO a_count
FROM attendance_day a,
workshft b
WHERE a.attd_date = a_prv_date
AND a.emp_code= AS_EMP_CODE
AND b.shift = a.shift
AND b.day_no= a.day_no
AND ddf_time_in_mm(a_time_punch)+1440 <= ddf_time_in_mm(b.out_time) + CASE WHEN b.out_time < b.in_time THEN 1440 ELSE 0 END + 300;
ELSE
SELECT COUNT(*)
INTO a_count
FROM attendance_day
WHERE attd_date = a_prv_date
AND emp_code = AS_EMP_CODE
AND out_time IS NULL;
END IF;
-------------------------------changes 13082013 starts-------------------
SELECT MAX(TIME_PUNCH)
INTO A_COUNT11
FROM ATTENDANCEMASTER
WHERE DATE_PUNCH = A_PRV_DATE
AND EMP_CD = AS_EMP_CODE
AND INOUT='I';
SELECT OUT_TIME
INTO A_COUNT22
FROM ATTENDANCE_DAY
WHERE EMP_CODE = AS_EMP_CODE
AND ATTD_DATE = a_prv_date;
DBMS_OUTPUT.PUT_LINE('value of In TIme : ' ||TO_CHAR(A_COUNT22)|| ' , Out Time : '|| TO_CHAR(A_COUNT11));
IF (A_COUNT11 > A_COUNT22) THEN
a_count:=1;
ELSE
a_count:=0;
END IF;
-------------------------------changes 13082013 ends-------------------
IF (a_count > 0) THEN
A_TIME_PUNCH := TO_CHAR((TO_NUMBER(SUBSTR(A_TIME_PUNCH,1,2))+24)) || ':' || SUBSTR(A_TIME_PUNCH,4,2);
UPDATE attendance_day
SET out_time = a_time_punch,
punch_str = punch_str || ' , -' || a_time_punch,
work_hour = (ddf_time_in_mm(a_time_punch) - ddf_time_in_mm(in_time))
WHERE attd_date = a_prv_date
AND emp_code = AS_EMP_CODE;
ELSE
INSERT INTO attendance_day(attd_date,emp_code,in_time,shift,day_no,chg_date,chg_user,chg_term,punch_str,lunch_time)
VALUES (AS_DATE_PUNCH,AS_EMP_CODE,a_time_punch,a_work_shift,TO_CHAR(AS_DATE_PUNCH,'D'),SYSDATE,USER,USERENV('terminal'),'-'|| AS_TIME_PUNCH,a_lunch_time);
END IF;
ELSE
INSERT INTO attendance_day(attd_date,emp_code,in_time,shift,day_no,chg_date,chg_user,chg_term,punch_str,lunch_time)
VALUES (AS_DATE_PUNCH,AS_EMP_CODE,a_time_punch,a_work_shift,TO_CHAR(AS_DATE_PUNCH,'D'),SYSDATE,USER,USERENV('terminal'),'-'|| AS_TIME_PUNCH,a_lunch_time);
END IF;
END IF;
END;
You might be better off just storing the punch data into attendancemaster table (allowing browsing, changes, confirmations, ...) and using sql to update attendance_day table in one shot just before the table is needed for further processing
Regards
Etbin
Similar Messages
-
New to pl/sql and need help with procedure
Hello there, I got two tables STAFF and BONUS which are not related by any constraints
STAFF
ID_NUMBER HIREDATE SALARY BONUS
100020 12-MAY-03 13600
100021 04-NOV-01 30000
100022 08-APR-02 28000
100023 08-APR-02 24000
BONUS
PERCENTAGE MORE_THAN_YEARS
0.1 3
0.15 5
0.3 7
0.45 9
0.5 12
I am trying to create a procedure that would calculate bonus based on years of employment according to bonus table.
If employees sysdate -hiredate is greater than 5, he would get salary*0.15%....
I created this procedure, but I got stuck here.
I calculated the length of employment for every soldier using cursor in a loop, but I don't know how to get values from bonus table and connect them together.
Please help me!
create or replace
procedure bonus_staff
as
cursor c1 is select *from staff;
bon real;
begin
FOR ITEM IN C1
LOOP
bon := FLOOR(months_BETWEEN(SYSDATE,ITEM.hiredate)/12)*
update staff
set bonus = bon
where id_number = ITEM.id_number;
exit when c1%notfound;
end loop;
end;
Thanks in advance..update staff
set bonus = (select percentage
from bonus
where more_than_years = (select max(more_than_years)
from bonus
where more_than_years <= FLOOR(months_BETWEEN(SYSDATE,staff.hiredate)/12)
You can do this in pure SQL, which operates on a set, so no PL/SQL is required.
Sybrand Bakker
Senior Oracle DBA -
Hi, can anyone explain me whether i need to make any changes to my procedure or it is perfectly fine.
/*WHENEVER SQLERROR EXIT FAILURE;
SET VERIFY OFF;
--SET SERVEROUTPUT ON;*/
CREATE OR REPLACE PROCEDURE sample_ord_sync_wrapper AS
DECLARE
l_request_id fnd_concurrent_requests.REQUEST_ID%TYPE;
l_program_id fnd_concurrent_requests.CONCURRENT_PROGRAM_ID%TYPE;
l_prog_app_id fnd_concurrent_requests.PROGRAM_APPLICATION_ID%TYPE;
l_p_include_IC_Ord VARCHAR2(1);
l_p_oid VARCHAR2(10);
l_db_cnt VARCHAR2(1):= 0;
l_err_msg VARCHAR2(500);
e_db_excep EXCEPTION;
BEGIN
l_request_id := fnd_global.conc_request_id;
l_program_id := fnd_global.conc_program_id;
l_prog_app_id := fnd_global.resp_appl_id;
l_p_include_IC_Ord := '&3';
l_p_oid := &4;
debug_pkg.initializedebugmessage (p_progname => 'SAMPLE_ORDER_SYNC_PKG',
p_debuglevel => TO_NUMBER('&2'),
p_debugmode => TO_NUMBER('&1'),
p_programappid => l_prog_app_id,
p_programid => l_program_id,
p_requestid => l_request_id
BEGIN
l_err_msg := 'Inside DBLink Validation';
debug_pkg.adddebugmessage(p_recordkey => NULL,
p_debugmessage => l_err_msg,
p_messagelevel => 0,
p_errorcode => NULL
-- Validating the DB Link
-- SELECT 1
-- INTO l_db_cnt
-- FROM dual@ERP2SAMPLE;
EXECUTE IMMEDIATE 'SELECT 1 FROM dual@ERP2SAMPLE' INTO l_db_cnt;
EXCEPTION
WHEN NO_DATA_FOUND THEN
debug_pkg.adddebugmessage
(p_recordkey => NULL,
p_debugmessage => 'DBLINK Not Found',
p_messagelevel => 0,
p_errorcode => 'Err:1000'
l_err_msg := TO_CHAR(SQLCODE) || ' and Errmsg: ' ||SUBSTR(SQLERRM, 1, 100);
RAISE e_db_excep;
WHEN OTHERS THEN
debug_pkg.adddebugmessage
(p_recordkey => NULL,
p_debugmessage => l_err_msg||' And errmsg: '||SUBSTR(SQLERRM, 1, 100),
p_messagelevel => 0,
p_errorcode => SQLCODE
l_err_msg := TO_CHAR(SQLCODE) || ' and Errmsg: ' ||SUBSTR(SQLERRM, 1, 100);
RAISE e_db_excep;
END;
--| Setting the org context to the org_id passsed as parameter.
--| The org_id from Resposponsiblity from which ths program is run may be different.
--| This is done as _all tables are not being used at every place due to perfromence reason.
SAMPLE_order_sync_pkg.Order_cancellation_PROC( p_Include_IC_Orders => l_p_include_IC_Ord
, p_Org_Id => l_p_oid);
SAMPLE_order_sync_pkg.Order_change_PROC( p_Include_IC_Orders => l_p_include_IC_Ord
, p_Org_Id => l_p_oid);
debug_pkg.PostDebugMessage;
COMMIT;
EXCEPTION
WHEN e_db_excep THEN
ROLLBACK;
debug_pkg.PostDebugMessage;
COMMIT;
fnd_file.put_line(fnd_file.output,'DBLink Validation Failed in sample_ord_sync_wrapper.sql Errcode: '||l_err_msg);
-- Raise_Application_Error(-20051,
-- 'DBLink Validation Failed in sample_ord_sync_wrapper.sql Errcode: ' ||l_err_msg);
WHEN OTHERS THEN
ROLLBACK;
debug_pkg.PostDebugMessage;
COMMIT;
fnd_file.put_line(fnd_file.output,'Unknown error in sample_ord_sync_wrapper.sql. Errcode: '||SQLCODE||' and errmsg: '||SUBSTR(SQLERRM, 1, 200) );
Raise_Application_Error(-20052,
'Unknown error in sample_ord_sync_wrapper.sql' ||
'SQLCODE=' || TO_CHAR(SQLCODE) || 'SQLERRM=' ||
SUBSTR(SQLERRM, 1, 80));
END;
/3360 wrote:
You should probably remove all the exception handling.
I say probably because trying to work out what will happen under certain error conditions makes my head hurt.
WHEN OTHERS THEN
ROLLBACK;
debug_pkg.PostDebugMessage;
COMMIT;
fnd_file.put_line(fnd_file.output,'Unknown error in sample_ord_sync_wrapper.sql....For example if this bit of code did not exist the error would not be unknown and whatever happened would not have already been committed.This thing they requested in their requirement so cannot take out, is that compulsory have to remove or still can proceed with that.
Actually this is the plsql program which i have changed to procedure by adding
CREATE OR REPLACE PROCEDURE sample_ord_sync_wrapper AS
instead of this
/*WHENEVER SQLERROR EXIT FAILURE;
SET VERIFY OFF;
--SET SERVEROUTPUT ON;*/.
iam not sure whether this change alone can change it as procedure or need to ammend some more inside. -
Hi everyone,
If someone can help me with this..
I have a mster table that is used by our billing software which is a non custom designed s/w. I still can work on the tables for that s/w but i do not want to modify any of them and get no references(set const as froeign keys) from them. I want to run some scripts and do some checking on the data..my primary key is invoice in the master table which is auto gen when ever a new invoice is created for a cust.
I want to create a table and that has some fields liked with this invoice...which wud be values like memo or some other comments in another table.
What i need to do is whenever a new record is inserted ie a new inv is generated the invoice number is added in to the sec tabble as well...But the problem here is that i dont want all the invoice numbers to be added as i said i am using a script to check for a condition..so if that invoice number exist true for that cond only then it cud be added....for example we can say it is checkin for total invoice being less then has a particular item so only those invoices with with that item should be added...in to the sec table..
Is there any way to do it without the use of triggers and can someone send me the syntax ...with either the use of triggers..or without them ..
AshishCan anyone help..?
Ashish -
All,
I have a function and a procedure in a package. The function is called by the procedure. The function returns multiple records with multiple fields in a table type. The procedure uses those values to update the database. My question is how can I get those values to update database. Need sample of code.
beloew is my package:
CREATE OR REPLACE PACKAGE "test_record2" as
type V_testre is record (
USER_ID NUMBER,
B_ID NUMBER,
A_ID NUMBER);
Type T_userInfo is table of user_Access %rowtype
index by binary_integer;
procedure get_info(userid in number);
function P_GetProfile(userid in number) return T_userInfo;
end;/
CREATE OR REPLACE PACKAGE BODY "test_record2" as
procedure get_info(userid in number) as
get_access T_userInfo;
v_userid number;
begin
get_access := P_GetProfile(v_userid);
--How to get the values from get_access to do the insert.
--Need help here!!!
--insert into test_access values get_access
end;
-- test table
function P_GetProfile(userid in number) return T_userInfo is
profile_info T_userInfo;
CURSOR c1 IS
select * from user_Access
where USER_ID = userid;
BEGIN
OPEN c1;
FETCH c1 BULK COLLECT INTO profile_info;
return profile_info;
END;
End;
--create the table
CREATE TABLE user_access (user_id NUMBER, m_id NUMBER, n_id NUMBER);
INSERT INTO user_access VALUES (1, 11, 111);
INSERT INTO user_access VALUES (1, 22, 222);
INSERT INTO user_access VALUES (1, 33, 333);
INSERT INTO user_access VALUES (2, 11, 111);
INSERT INTO user_access VALUES (2, 22, 222);
INSERT INTO user_access VALUES (2, 33, 333);CALL is not valid PL/SQL. (In fact, it's only valid in OLAP).
You want either...
BEGIN
test_record2.get_info(1);
END;
/...or (in SQL*Plus)....
EXEC test_record2.get_info(1)I commend the documentation to you.
Cheers, APC -
i need help. every time i turn on my laptop an error message pops up: the procedure entry point sqlite_wao -checkpoint could not be located in the dynamic link library SQLite3.dlll HOW DO I FIX THIS?
Hi whatsthe77,
Welcome to Apple Support Communities.
You may want to follow the steps in this article to reinstall iTunes:
Removing and reinstalling iTunes, QuickTime, and other software components for Windows Vista or Windows 7
http://support.apple.com/kb/HT1923
Have a great day,
Jeremy -
Stored DB Procedure - Need help
Hi. I have a stored database package containing 2 functions. I need help with the function named ret_columns.
If you look at the code below you will see this function has two different FOR loops. The Select statement in FOR loop that is commented out works just fine, but when I try to use the uncommented select statement in it's place the Function returns NULL (or no records). However, if I run the Select statement in plain old SQL Plus it returns the rows I need. I don't get it.
Can anyone help me? I'm really stuck on this one.
-- PACKAGE BODY
CREATE OR REPLACE package body audit_table_info
as
function ret_tables return table_type is
t_t table_type;
i integer;
begin
i := 1;
for rec in (select distinct table_name
from all_triggers
where substr(trigger_name,1,9) = upper('tr_audit#')) loop
t_t(i).tableA := rec.table_name;
i := i+1;
end loop;
return t_t;
end;
function ret_columns return column_type is
c_t column_type;
i integer;
begin
i := 1;
-- for rec in (select distinct table_name column_name
-- from all_triggers
-- where substr(trigger_name,1,9) = upper('tr_audit#')) loop
for rec in (select distinct b.column_name column_name
from all_triggers a, all_tab_columns b
where a.table_owner = b.owner
and a.table_name = b.table_name
and substr(a.trigger_name,1,9) = upper('tr_audit#') and rownum < 5) loop
c_t(i).tableB := rec.column_name;
i := i+1;
end loop;
return c_t;
end;
end audit_table_info;
-- PACKAGE DEFINITION
CREATE OR REPLACE package Audit_Table_Info as
type table_rec is record( tableA all_tab_columns.TABLE_NAME%type);
type table_type is table of table_rec index by binary_integer;
function ret_tables return table_type;
type column_rec is record( tableB all_tables.TABLE_NAME%type);
type column_type is table of column_rec index by binary_integer;
function ret_columns return column_type;
end Audit_Table_Info;
/It works when I do this!!! I'm so confused.
Ok...so I did this:
1 create table test_columns as
2 (select b.column_name
3 from all_triggers a,
4 all_tab_columns b
5 where a.table_owner = b.owner
6 and a.table_name = b.table_name
7 and substr(a.trigger_name,1,9) = upper('tr_audit#')
8* and rownum < 5)
SQL> /
Table created.
Then altered the Function so the Select statement refers to this table:
function ret_columns return column_type is
c_t column_type;
i integer;
begin
i := 1;
for rec in (select distinct column_name
from test_columns) loop
c_t(i).tableB := rec.column_name;
i := i+1;
end loop;
return c_t;
end;
Again, any help would be greatly greatly appreciated! -
Weird error message need help..
SO.. i havent updated my itunes in a while because i keep getting this weird message.. it comes up when im almost done installing the newest/newer versions of itunes. it says
"the feature you are trying to use is on a network resource that is unavailable" "click ok to try again or enter an alternate path to a folder containing the installation package 'iTunes.msi' in the box below"
now when ever i choose a file from the browse box it replies with this message "the file 'xxx' is not a valid installation package for the product iTunes. try to find the installation package iTunes.msi in a folder from which you can install iTunes."
no idea need help thanks
~~~lake
Message was edited by: DarkxFlamexCaster
Message was edited by: DarkxFlamexCaster+it comes up when im almost done installing the newest/newer versions of itunes. it says+ +"the feature you are trying to use is on a network resource that is unavailable" "click ok to try again or enter an alternate path to a folder containing the installation package 'iTunes.msi' in the box below"+
With that one, let's try the following procedure.
First, head into your Add/Remove programs and uninstall your QuickTime. If it goes, good. If it doesn't, we'll just attend to it when we attend to iTunes.
Next, download and install the Windows Installer CleanUp utility:
Description of the Windows Installer CleanUp Utility
Now launch Windows Installer CleanUp ("Start > All Programs > Windows Install Clean Up"), find any iTunes and/or QuickTime entries in the list of programs in CleanUp, select those entries, and click “remove”.
Next, we'll manually remove any leftover iTunes or QuickTime program files:
(1) Open Local Disk (C:) in Computer or whichever disk programs are installed on.
(2) Open the Program Files folder.
(3) Right-click the iTunes folder and select Delete and choose Yes when asked to confirm the deletion.
(4) Right-click the QuickTime folder and select Delete and choose Yes when asked to confirm the deletion. (Note: This folder may have already been deleted if QuickTime was successfully removed using Add/Remove Programs earlier.)
(5) Delete the QuickTime and QuicktimeVR files located in the C:\Windows\system32\ folder. Click Continue if Windows needs confirmation or permission to continue. (Note: These files may have already been deleted if QuickTime was successfully removed using Add/Remove Programs earlier.)
(6) Right-click on the Recycle Bin and on the shortcut menu, click Empty Recycle Bin.
(7) Restart your computer.
Now try another iTunes install. Does it go through properly now? -
Need Help to create new screen for RF Sapconsole
Hi Guru's
I'm new on RF (but some years in ABAP) since last week.
I need help to create new screens for RF (SAPLLMOB).
Can someone explain me the procedure to create screen (with ABAP code after) or perhaps someone have an exemple (simple or not) ?
I have to develop 2 new screens with really few time.
And, another subsidiary question :
how SAP can transfert information between the flash gun and the screen i have developped.
Is there some code to add to enable this functionality or it is include in SAPLLMOB on standard fields ????
It's a new strange world for me today...
Many thanks to everyone who can explain me
Alainhi,
I am facing this problem as well. Is there any reference to create the new screen?
Hope someone can help! Thanks!
Regards,
Darren -
Hi experts,
Need help with IDOC. I'm creating 2 FM to process an existing idoc.
first FM will use the data from idoc 1 to populate EDIDD for idoc 2.
second FM will use the data from idoc 2 to populate EDIDD for idoc 3.
when during processing, I encountered error message "No function module for input process code <second FM>".
although i already link the FM to be used, why does FM 1 cannot call FM 2 directly?
Thanks.In LSMW object attributes... give like this..
Message Type CREMAS Vendor master data distri
Basic Type CREMAS04 Vendor master data distri
Enhancement
after that continue normal LSMW procedure. -
Need help configuring Excel Services
I've configured both the Excel Serives and Secure Store Target applications and continually receive the following error message when trying to view the Simple Projects List sample report:
An error occurred while accessing application id ProjectServerApplication from Secure Store Service. The following connections failed to refresh:
Project Server - Simple Projects List
The Server Logs show the following errors:
Access Denied: Claims stored in the credentials did not match with the group claim for a group app.
The Microsoft Secure Store Services application Secure Store Service failed to retrieve credentials. The error returned was 'Access Denied.' ...
Access is denied. (Fault Detail is equal to Microsoft.Office.SecureStoreService.Server.SecureStoreServiceFault)
SSS has failed with the following exception: Access is denied.
Unable to esablish a connection using credentials retrieved from SSS. This could be because the Unattended Service Account is not configured or because the credentials retrieved from SSS are not valid.
I've repeated the steps to create these configurations a few times, and continue to get the same errors. Any help would be appreciated!
ThanksHello,
I need help setting up excel services.
Excel service is already running on sharepoint server.
I have one reporting file which is generated by DBA with database connection. i want to upload that file under document library and i want whenever user open it through document library, it gets updated through database connection
This is my first time, so pls guide me
Reporting file has authentication set to --> None
Do i require any specific settings for authentication? like unattended account ? which username should i use
Connection String -->
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=True;User ID=ExcelServices;Initial Catalog=SurveyData;Data Source=jdb1;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=RSTKW7W-06709;Use Encryption for Data=False;Tag
with column collation when possible=False
http://../training/sptestsite/Medication_Audit_Report
http://../training/sptestsite/Medication_Audit_Data_Connection_Library/
Trusted File Location - is this place do i need to upload that reporting file?
Trusted Data Connection Libraries - is this place do i need to save connection file .odc ?
If i am not wrong, should i put
Trusted File Location = http://../training/sptestsite/Medication_Audit_Report
Trusted Data Connection Libraries = http://../training/sptestsite/Medication_Audit_Data_Connection_Library/
http://../training/sptestsite/Medication_Audit_Report -- Here only reporting file will be uploaded right?
http://../training/sptestsite/Medication_Audit_Data_Connection_Library/ -- Here only database connection .odc file will be uploaded?
what other settings are required. please correct me
my email address - [email protected]
Harsh -
I NEED HELP My cellular data is not working! I called and went to Apple INC. And At
So after July 4th 2013 I experienced wi-fi problems. I wasn't able to keep connected and i kept getting kicked out my own wi-fi. I left it continue a while because i thought it was only temporary. But i noticed my cellular data with at&t hadn't been working properly for about a month. Then it started getting worse till the point now I cannot use nor wi-fi nor cellular data. I called Apple Inc., they thought it was a bug, and we took procedures for trying to fix it. We restarted it, and reset network settings. Finally they suggested calling or going into at&t. I called first and we did almost same exact procedures as apple. So I decided going into At&t, they changed my original sim card and was only recieving 1 bar of signal, but i was bad. I couldn't do anything. After they scheduled and appointment at Apple store, ugh! which was such bad service. People everywhere and rushed through my problem and he didn't even let me explain. He only suggested I buy their ipad exchaging mine. In which come on. I couldn't back up my photos and stuff that instant. I asked him to give me a minute and he never came back. Like what was the point of that appointmet? After leaving I walked about 2 streets down and all my cellular data bars and 3g were up. It only worked there and when i was driving home and got home nothing once again. Not even inside the store. i mean others wi-fi works in some areas and my cellular data was good until now . I know At&t told me they were not experiencing any technical issues and everything was good, so i know its not due to that. My siste's mini ipad is working fine, so is my sisters ipod. I really need help and someone to take time in reading this and or helping me.Please thanks!
Has any had you try a reset yet? Sometimes the WiFi & Cellular anntennas get wacky.
Hold Sleep/Wak & Home buttons until the screen goes dark and you see the Apple logo -
Need Help in Customization of OTL Time Keeper Layout for Projects.
Hi All,
Need help in customization of OTL Time Keeper.
Requirement:
Required to change the Project Layout Template as Payroll Layout Template.
In Payroll Layout Template the days consits of start and end time and total time per day.
Similary need to reproduce the same content Layout as it is in Payroll.
Can Anybody suggest the procedure to achive this task
Thanks and Regards,
Chaitanya.Hi,
Can someone please Help me on this ...
Regards,
Tarun -
Need Help existing Crystal 8.5 to Ver.11 Install and SmartViewerActiveX.asp
How to get my reports working, required Install onto Server? Version Changes to Code?
Like other developers I am trying to reconfigure an existing solution / application that uses Crystal Reports 8.5 & RDC to call and display reports now moving to Crystal Reports XI =Ver.11. Here is an almost identical issue that I have used for the basis of my question.
Link: [ CRViewer - Crystal 8.5 VS. Crystal 11|http://www.tek-tips.com/viewthread.cfm?qid=1505100&page=6|From www.tek-tips.com]
Just like the linked site's questions for the reports, our ActiveX viewer is called from within the ASP code SmartViewerActiveX.asp from Ver 8.5, we now have Crystal Reports XI = Ver.11 Developer.
However I am not sure that the other site was clear with the procedure for deployment and setup and that's why I am seeking help with the Crystal Reports we have in our projects.
Do I install Crystal Reports XI Developer onto the Server to get the VIEWER?
What configuration is required so that the NEW Ver. 11 viewer works with 8.5?
What code changes are required to use a new Activex Viewer object?
I have legacy Crystal Reports solution using 8.5 and moving to Crystal Ver. 11. Need help with clear requirements for what is required and how to install the required components to the WEB SERVER / IIS Server. Using "Unmanaged" Reports with Crystal Dev. Edition Ver. 8.5 to Ver. 11. Currently 8.5 is not working I suspect due to the viewer not being installed to the server.
CODE LINE from my SmartViewerActiveX.asp in my IIS server.....
"/viewer9/activeXViewer/activexviewer.cab#Version=9,2,0,442"
I have not found a virtual folder reference to a folder that contains, /viewer9/activeXViewer/activexviewer.cab on the IIS server. Keep in mind this is a NEW server with many of the application solutions copied to it without complete migration steps and possibly missing installation steps such as Crystal Reports Developer CD Ver.11.
Below are the steps I had found at the LINK above, however I need validation if this is the correct steps and clarification of the steps. This will eventually be going onto a PRODUCTION server and I need to minimize the possibility of killing other apps and potentially the server. (Windows 2003 Server, with Mainly VISTA and Win 7 clients via IE. 8 to present version.)
From: (http://www.tek-tips.com/viewthread.cfm?qid=1505100&page=6)
NEED MORE DETAILS
1. Install CR11 developer to server
2. Setup Virtual Path within IIS for ActiveX component
C:\program files\common........\Busines objects\3.0\CrystalReportsViewers11\activexcontrols
3. Check registry to get classid for activex control
hkey_classes_root
Crystalreports.activexreportviewer
CLSID
CurVer
4. Change code to use new activex control page: Smartvieweractivex.asp
5. migrate reports from Crystal Reports 8.5 to 11
6. run application and open report using CR11 viewer
Help would be greatly appreciated!
Thanks.
EThanks for ALL your feedback!
Still not there yet with a solution or option from the last reply....
I tried to be as brief as possible, however it appears that there are MANY issues surrounding Crystal Reports in General let alone the versions and applications that had been developed and very little straight forward information on how to migrate/move and use existing applications on NEW servers (NOTE: Old CR 8.5 is running in a newer environment as it had been developed at the Company that had previously owned us.).
I am trying to get the application that is OLD re-deployed into a new company, with old data, old reports, just to make the existing solution work. Crystal Reports Ver. 11 was brought into the mix when a copy of Crystal 8.5 could not be purchased by our new company. Right after purchase of Ver.11, I was able to get the original 8.5 DEV CD and License from our old company.
Q: 1) "/viewer9/activeXViewer/activexviewer.cab#Version=9,2,0,442"
A: This is what is on the server that the Crystal Reports 8.5 solution is running on in the server environment that it currently is running and working in. PROBLEM.. The Our Comapny is no longer part of the other Company... They have theirs running without issue with Crystal 8.5 Reports, and the command line listed above on their IIS server... This is what was given to me to migrate into our NEW Company environment.
Q: 2) CR 11 is rather undefined... There is CR XI Release 1 (11.0)
A: APPEARS that I have CR XI Release 1 (11.0) - HELP ABOUT SHOWS 11.0.0.1282
Q: How do you get the app on your server? Use the RDC merge modules and create a setup or an MSI.
Not sure what, "...Use the RDC merge modules and create a setup or an MSI..." involves??
Why Can't I just install this using the CR Dev. CD.? The Product was purchased with 2 Licenses.
I also have the OLD Crystal Reports Developer Ver. 8.5 CD that could be used to re-deploy the viewers.
Q: Did you realize that the RDC is retired in CR 11.5?... ETC..
A: Yes, again why cant the existing solution of Crystal Reports 8.5 RPT files be used on the IIS server being called via Crystal Reports 8.5 Viewers... I have access to the original 8.5 CD,.. Again not sure how to deploy the VIEWERS part to the server..
Trying to get the simplest solution to have the existing 8.5 Reports, running from the IIS Web Server using the ActiveX viewer and URL Calls...
ALL HELP IS WELCOME!
Thanks
E. -
Need help in Creating External Tables
Hi All,
I have a flat file containing numberic data, CLOB data, and also date columns data. I have to load this flat file data into staging server table using External tables. I have to write a stored procedure in such way creating exteranl tables dynamically. My question or need help from you people is that how to define the external table to load the CLOB data from flat file.
Thanks,
SankarThe LOCATION clause of an external table specifies the file or files to be read when the table is queried. You can change it to refer to different files without dropping and recreating the table and invalidating all dependent code.
Regarding DBMS_SQL, yes you can do it the hard way if you prefer.
Good point about CLOB columns in external tables. Quite possibly they are not supported, but I would have to check the manuals and try some examples.
Maybe you are looking for
-
How can I create a line break in pages for iPad?
On the Mac you can hold the shift key while pressing the return key to creat a line break. Only pressing the return key will creat a new paragraph of course. On the iPad you only can creat paragraphs. Pressing the shif key does not change that. Does
-
Hiding a column in jtable made from DefaultTableModel.
I have made my jtable from DefaultTableModel. I want to keep one column in the jtable as hidden storing some data containing neccessary information like the "path of the file" which need not be shown to the user. Please tell me how I can hide one col
-
Hi, Please tell me steps for how to create Menu Exit. Please Help me
-
i cant complete my album: "this article is about to change. try again later" what can i do?
-
UJ862AS DVD-RAM doesn't recognize -R discs on Satellite U400
For some reason my DVD drive wil no longer recognizes -R discs. I have a MAT****A DVD-RAM UJ862AS drive. Any clues?