Sunday, May 14, 2023
Thursday, November 21, 2019
Accounting fun: This is how to ask for a raise.
12:39 PM
No comments
Accounting fun: This is how to ask for a raise.: A student accountant in the US wrote to his senior partner asking for an increased salary. Dear Bo$$ In thi$ life, we all need $ome things m...
Wednesday, February 20, 2019
Data Base Issues - Oracle EBS R12: Checking swap space: 0 MB available, 1535 MB requi...
4:26 PM
No comments
Data Base Issues - Oracle EBS R12: Checking swap space: 0 MB available, 1535 MB requi...: http://dbissues.blogspot.com/2016/02/i-am-trying-to-install-portal-forms.html I am trying to install "Oracle Reports and forms ...
Thursday, February 7, 2019
use sql case
12:13 PM
No comments
Mastering+Oracle+SQL
SELECT pm.emp_no, pm.ipd_admission_dept,
(SELECT dept_name
FROM hr_dept
WHERE dept_no = 1168) ipd_admission_cp, pm.ipd_visitor_dept,
(SELECT dept_name
FROM hr_dept
WHERE dept_no = 1183) ipd_visitor_cp, pm.em_billing_dept,
(SELECT dept_name
FROM hr_dept
WHERE dept_no = 1197) em_billing_cp, pm.ipd_epi_dept,
(SELECT dept_name
FROM hr_dept
WHERE dept_no = 1204) epi_cp, fnc_empname (pm.emp_no) ename,
SUM (pm.pay_amt) pay_amt, SUM (pm.c_amt) p_amt, SUM (pm.n_amt) n_amt,
SUM (pm.c_amt - pm.n_amt) tot_fract, SUM (pm.ref_amt) ref_amt,
(SUM (pm.pay_amt + pm.c_amt) - SUM (pm.n_amt + pm.ref_amt)
) net_coll
FROM (SELECT entered_by emp_no, (SELECT dept_no
FROM hr_dept
WHERE dept_no = 1168)
ipd_admission_dept,
(SELECT dept_no
FROM hr_dept
WHERE dept_no = 1183) ipd_visitor_dept,
(SELECT dept_no
FROM hr_dept
WHERE dept_no = 1197) em_billing_dept,
(SELECT dept_no
FROM hr_dept
WHERE dept_no = 1204) ipd_epi_dept,
CASE
WHEN trx_code_no IN ('PM', 'DP')
THEN ABS (cr_amt - dr_amt)
ELSE 0
END pay_amt,
CASE
WHEN trx_code_no IN ('PC', 'RC')
THEN ABS (cr_amt - dr_amt)
ELSE 0
END c_amt,
CASE
WHEN trx_code_no = 'NC'
THEN ABS (cr_amt - dr_amt)
ELSE 0
END n_amt,
CASE
WHEN trx_code_no = 'RF'
THEN ABS (cr_amt - dr_amt)
ELSE 0
END ref_amt
FROM fn_patledger
WHERE dept_no IN (1204, 1168, 1183, 1197)
AND entered_by = NVL (UPPER (:p_entered_by), entered_by)
AND TRUNC (entry_timestamp) BETWEEN NVL (:p_date_1,
TRUNC (entry_timestamp)
)
AND NVL (:p_date_2,
TRUNC (entry_timestamp)
)) pm
GROUP BY pm.emp_no,
pm.ipd_admission_dept,
pm.ipd_visitor_dept,
pm.em_billing_dept,
pm.ipd_epi_dept
ORDER BY fnc_empname (pm.emp_no)
##---
SELECT COUNT (reg_no) total, gender, CATEGORY,
CASE CATEGORY
WHEN 'Infant'
THEN 1
WHEN 'Child'
THEN 2
WHEN 'Young'
THEN 3
WHEN 'Adult'
THEN 4
WHEN 'Senior'
THEN 5
WHEN 'Most Senior'
THEN 6
ELSE 7
END cat
FROM (SELECT reg_no, gender, CATEGORY
FROM ehrv_patientlist_today
WHERE appoint_date BETWEEN NVL (:p_dt1, appoint_date)
AND NVL (:p_dt2, appoint_date))
GROUP BY gender, CATEGORY
ORDER BY cat;
----use case in where condition
WHERE patinfo.pathology =
CASE
WHEN NVL (p_pathology, 'N') = 'N'
AND NVL (p_imaging, 'N') = 'N'
AND NVL (p_due, 'N') = 'N'
AND NVL (p_overdue, 'N') = 'N'
AND NVL (p_ot, 'N') = 'N'
AND NVL (p_cannula, 'N') = 'N'
THEN NVL (p_pathology, patinfo.pathology)
ELSE p_pathology
END
OR patinfo.imaging =
CASE
WHEN NVL (p_pathology, 'N') = 'N'
AND NVL (p_imaging, 'N') = 'N'
AND NVL (p_due, 'N') = 'N'
AND NVL (p_overdue, 'N') = 'N'
AND NVL (p_ot, 'N') = 'N'
AND NVL (p_cannula, 'N') = 'N'
THEN NVL (p_imaging, patinfo.imaging)
ELSE p_imaging
END
OR patinfo.due =
CASE
WHEN NVL (p_pathology, 'N') = 'N'
AND NVL (p_imaging, 'N') = 'N'
AND NVL (p_due, 'N') = 'N'
AND NVL (p_overdue, 'N') = 'N'
AND NVL (p_ot, 'N') = 'N'
AND NVL (p_cannula, 'N') = 'N'
THEN NVL (p_due, patinfo.due)
ELSE p_due
END
OR patinfo.overdue =
CASE
WHEN NVL (p_pathology, 'N') = 'N'
AND NVL (p_imaging, 'N') = 'N'
AND NVL (p_due, 'N') = 'N'
AND NVL (p_overdue, 'N') = 'N'
AND NVL (p_ot, 'N') = 'N'
AND NVL (p_cannula, 'N') = 'N'
THEN NVL (p_overdue, patinfo.overdue)
ELSE p_overdue
END
OR patinfo.cann =
CASE
WHEN NVL (p_pathology, 'N') = 'N'
AND NVL (p_imaging, 'N') = 'N'
AND NVL (p_due, 'N') = 'N'
AND NVL (p_overdue, 'N') = 'N'
AND NVL (p_ot, 'N') = 'N'
AND NVL (p_cannula, 'N') = 'N'
THEN NVL (p_cannula, patinfo.cann)
ELSE p_cannula
END
OR patinfo.pot =
CASE
WHEN NVL (p_pathology, 'N') = 'N'
AND NVL (p_imaging, 'N') = 'N'
AND NVL (p_due, 'N') = 'N'
AND NVL (p_overdue, 'N') = 'N'
AND NVL (p_ot, 'N') = 'N'
AND NVL (p_cannula, 'N') = 'N'
THEN NVL (p_ot, patinfo.pot)
ELSE p_ot
END
AND patinfo.death = NVL (p_death, patinfo.death);
-----use >any means greate than smaller number
>all means greater than largest number
multicolumn subquery example
select * from emp where (sal,dept) in
(select max(sal),dept_no from emp group by dept)
SELECT pm.emp_no, pm.ipd_admission_dept,
(SELECT dept_name
FROM hr_dept
WHERE dept_no = 1168) ipd_admission_cp, pm.ipd_visitor_dept,
(SELECT dept_name
FROM hr_dept
WHERE dept_no = 1183) ipd_visitor_cp, pm.em_billing_dept,
(SELECT dept_name
FROM hr_dept
WHERE dept_no = 1197) em_billing_cp, pm.ipd_epi_dept,
(SELECT dept_name
FROM hr_dept
WHERE dept_no = 1204) epi_cp, fnc_empname (pm.emp_no) ename,
SUM (pm.pay_amt) pay_amt, SUM (pm.c_amt) p_amt, SUM (pm.n_amt) n_amt,
SUM (pm.c_amt - pm.n_amt) tot_fract, SUM (pm.ref_amt) ref_amt,
(SUM (pm.pay_amt + pm.c_amt) - SUM (pm.n_amt + pm.ref_amt)
) net_coll
FROM (SELECT entered_by emp_no, (SELECT dept_no
FROM hr_dept
WHERE dept_no = 1168)
ipd_admission_dept,
(SELECT dept_no
FROM hr_dept
WHERE dept_no = 1183) ipd_visitor_dept,
(SELECT dept_no
FROM hr_dept
WHERE dept_no = 1197) em_billing_dept,
(SELECT dept_no
FROM hr_dept
WHERE dept_no = 1204) ipd_epi_dept,
CASE
WHEN trx_code_no IN ('PM', 'DP')
THEN ABS (cr_amt - dr_amt)
ELSE 0
END pay_amt,
CASE
WHEN trx_code_no IN ('PC', 'RC')
THEN ABS (cr_amt - dr_amt)
ELSE 0
END c_amt,
CASE
WHEN trx_code_no = 'NC'
THEN ABS (cr_amt - dr_amt)
ELSE 0
END n_amt,
CASE
WHEN trx_code_no = 'RF'
THEN ABS (cr_amt - dr_amt)
ELSE 0
END ref_amt
FROM fn_patledger
WHERE dept_no IN (1204, 1168, 1183, 1197)
AND entered_by = NVL (UPPER (:p_entered_by), entered_by)
AND TRUNC (entry_timestamp) BETWEEN NVL (:p_date_1,
TRUNC (entry_timestamp)
)
AND NVL (:p_date_2,
TRUNC (entry_timestamp)
)) pm
GROUP BY pm.emp_no,
pm.ipd_admission_dept,
pm.ipd_visitor_dept,
pm.em_billing_dept,
pm.ipd_epi_dept
ORDER BY fnc_empname (pm.emp_no)
##---
SELECT COUNT (reg_no) total, gender, CATEGORY,
CASE CATEGORY
WHEN 'Infant'
THEN 1
WHEN 'Child'
THEN 2
WHEN 'Young'
THEN 3
WHEN 'Adult'
THEN 4
WHEN 'Senior'
THEN 5
WHEN 'Most Senior'
THEN 6
ELSE 7
END cat
FROM (SELECT reg_no, gender, CATEGORY
FROM ehrv_patientlist_today
WHERE appoint_date BETWEEN NVL (:p_dt1, appoint_date)
AND NVL (:p_dt2, appoint_date))
GROUP BY gender, CATEGORY
ORDER BY cat;
----use case in where condition
WHERE patinfo.pathology =
CASE
WHEN NVL (p_pathology, 'N') = 'N'
AND NVL (p_imaging, 'N') = 'N'
AND NVL (p_due, 'N') = 'N'
AND NVL (p_overdue, 'N') = 'N'
AND NVL (p_ot, 'N') = 'N'
AND NVL (p_cannula, 'N') = 'N'
THEN NVL (p_pathology, patinfo.pathology)
ELSE p_pathology
END
OR patinfo.imaging =
CASE
WHEN NVL (p_pathology, 'N') = 'N'
AND NVL (p_imaging, 'N') = 'N'
AND NVL (p_due, 'N') = 'N'
AND NVL (p_overdue, 'N') = 'N'
AND NVL (p_ot, 'N') = 'N'
AND NVL (p_cannula, 'N') = 'N'
THEN NVL (p_imaging, patinfo.imaging)
ELSE p_imaging
END
OR patinfo.due =
CASE
WHEN NVL (p_pathology, 'N') = 'N'
AND NVL (p_imaging, 'N') = 'N'
AND NVL (p_due, 'N') = 'N'
AND NVL (p_overdue, 'N') = 'N'
AND NVL (p_ot, 'N') = 'N'
AND NVL (p_cannula, 'N') = 'N'
THEN NVL (p_due, patinfo.due)
ELSE p_due
END
OR patinfo.overdue =
CASE
WHEN NVL (p_pathology, 'N') = 'N'
AND NVL (p_imaging, 'N') = 'N'
AND NVL (p_due, 'N') = 'N'
AND NVL (p_overdue, 'N') = 'N'
AND NVL (p_ot, 'N') = 'N'
AND NVL (p_cannula, 'N') = 'N'
THEN NVL (p_overdue, patinfo.overdue)
ELSE p_overdue
END
OR patinfo.cann =
CASE
WHEN NVL (p_pathology, 'N') = 'N'
AND NVL (p_imaging, 'N') = 'N'
AND NVL (p_due, 'N') = 'N'
AND NVL (p_overdue, 'N') = 'N'
AND NVL (p_ot, 'N') = 'N'
AND NVL (p_cannula, 'N') = 'N'
THEN NVL (p_cannula, patinfo.cann)
ELSE p_cannula
END
OR patinfo.pot =
CASE
WHEN NVL (p_pathology, 'N') = 'N'
AND NVL (p_imaging, 'N') = 'N'
AND NVL (p_due, 'N') = 'N'
AND NVL (p_overdue, 'N') = 'N'
AND NVL (p_ot, 'N') = 'N'
AND NVL (p_cannula, 'N') = 'N'
THEN NVL (p_ot, patinfo.pot)
ELSE p_ot
END
AND patinfo.death = NVL (p_death, patinfo.death);
-----use >any means greate than smaller number
>all means greater than largest number
multicolumn subquery example
select * from emp where (sal,dept) in
(select max(sal),dept_no from emp group by dept)
Friday, December 28, 2018
Wednesday, September 19, 2018
Alert
10:18 AM
No comments
Use this alert and example for a for loop :
SET_ALERT_PROPERTY('ALT_TWO',ALERT_MESSAGE_TEXT,'Do you want to Send Requisition ?');
V_ALERT:=SHOW_ALERT('ALT_TWO');
PICTURE
IF V_ALERT=ALERT_BUTTON1 THEN
GO_BLOCK('SRV_REQUISITION');
LAST_RECORD;
IF :SRV_REQUISITION.TEST_NO IS NULL THEN
DELETE_RECORD;
END IF;
V_TEST_COUNT:=:SYSTEM.CURSOR_RECORD;
FIRST_RECORD;
FOR I IN 1..V_TEST_COUNT LOOP
IF :SRV_REQUISITION.TEST_NO IS NOT NULL THEN
--MSGBOX(:SRV_REQUISITION.TEST_NO);
LIST_TEST(I) :=:SRV_REQUISITION.TEST_NO;
LIST_TEST_QTY(I) :=NVL(:SRV_REQUISITION.QUANTITY,1) ; --:CTRL_INVESTIGATIONINFO.QTY;
LIST_STATUS(I) :=:SRV_REQUISITION.DELIVERY_STATUS; --:CTRL_INVESTIGATIONINFO.DELIVERY_STATUS;
LIST_SERVICE(I) :=:SRV_REQUISITION.TEST_TYPE;
LIST_REMARKS(I) :=:SRV_REQUISITION.REMARKS; --:CTRL_INVESTIGATIONINFO.REMARKS;
LIST_TEST_AMT(I) :=:SRV_REQUISITION.RATE;
LIST_INSTRUCTION(I) :=:SRV_REQUISITION.INSTRUCTION;
LIST_SAMPLE(I) :=:SRV_REQUISITION.SAMPLE_ID;
LIST_DELIVERY_DT(I) :=SYSDATE;
-- LIST_BILL_TYPE(I) :=0; --HOLDS BILL TYPE
LIST_LETTER_NO(I) :=:CTRL_CCPATIENT.REF_LETTERNO;
LIST_DISC(I) :=NULL;
LIST_DISC_AMT(I) :=0; --HOLDS TEST'S DISCOUNT AMOUNT
LIST_VAT_AMT(I) :=0; --HOLDS TEST'S VAT AMOUT
LIST_DX_RX_NO(I) :='';
--GRANT_DISCAMT :=0; --HOLDS TEST'S DISCOUNT TOTAL AMOUNT
--LIST_CLNT_ID(I) :=NVL(:CTRL_CASHPOINT.CLIENT,1);---1 FRO SERVICE PROVIDER
LIST_RATEGRP(I) :=NVL(:CTRL_CASHPOINT.RATE_GROUP,1) ;
IF :CTRL_CCPATIENT.REF_LETTERNO is not null then
LIST_BILL_TYPE(I):=1;--- IF IT IS CORPORATE NEED NOT TO PAY
LIST_PATPAY(I) :='N';
LIST_CLNT_ID(I) :=:CTRL_CCPATIENT.CLNT_ID;
ELSE
LIST_BILL_TYPE(I):=0;
LIST_PATPAY(I) :='Y';
LIST_CLNT_ID(I) :=1;
END IF;
-- V_CHECKEXIST:=V_CHECKEXIST+1;
NEXT_RECORD;
ELSE
NEXT_RECORD;
END IF;
END LOOP;
SET_ALERT_PROPERTY('ALT_TWO',ALERT_MESSAGE_TEXT,'Do you want to Send Requisition ?');
V_ALERT:=SHOW_ALERT('ALT_TWO');
PICTURE
IF V_ALERT=ALERT_BUTTON1 THEN
GO_BLOCK('SRV_REQUISITION');
LAST_RECORD;
IF :SRV_REQUISITION.TEST_NO IS NULL THEN
DELETE_RECORD;
END IF;
V_TEST_COUNT:=:SYSTEM.CURSOR_RECORD;
FIRST_RECORD;
FOR I IN 1..V_TEST_COUNT LOOP
IF :SRV_REQUISITION.TEST_NO IS NOT NULL THEN
--MSGBOX(:SRV_REQUISITION.TEST_NO);
LIST_TEST(I) :=:SRV_REQUISITION.TEST_NO;
LIST_TEST_QTY(I) :=NVL(:SRV_REQUISITION.QUANTITY,1) ; --:CTRL_INVESTIGATIONINFO.QTY;
LIST_STATUS(I) :=:SRV_REQUISITION.DELIVERY_STATUS; --:CTRL_INVESTIGATIONINFO.DELIVERY_STATUS;
LIST_SERVICE(I) :=:SRV_REQUISITION.TEST_TYPE;
LIST_REMARKS(I) :=:SRV_REQUISITION.REMARKS; --:CTRL_INVESTIGATIONINFO.REMARKS;
LIST_TEST_AMT(I) :=:SRV_REQUISITION.RATE;
LIST_INSTRUCTION(I) :=:SRV_REQUISITION.INSTRUCTION;
LIST_SAMPLE(I) :=:SRV_REQUISITION.SAMPLE_ID;
LIST_DELIVERY_DT(I) :=SYSDATE;
-- LIST_BILL_TYPE(I) :=0; --HOLDS BILL TYPE
LIST_LETTER_NO(I) :=:CTRL_CCPATIENT.REF_LETTERNO;
LIST_DISC(I) :=NULL;
LIST_DISC_AMT(I) :=0; --HOLDS TEST'S DISCOUNT AMOUNT
LIST_VAT_AMT(I) :=0; --HOLDS TEST'S VAT AMOUT
LIST_DX_RX_NO(I) :='';
--GRANT_DISCAMT :=0; --HOLDS TEST'S DISCOUNT TOTAL AMOUNT
--LIST_CLNT_ID(I) :=NVL(:CTRL_CASHPOINT.CLIENT,1);---1 FRO SERVICE PROVIDER
LIST_RATEGRP(I) :=NVL(:CTRL_CASHPOINT.RATE_GROUP,1) ;
IF :CTRL_CCPATIENT.REF_LETTERNO is not null then
LIST_BILL_TYPE(I):=1;--- IF IT IS CORPORATE NEED NOT TO PAY
LIST_PATPAY(I) :='N';
LIST_CLNT_ID(I) :=:CTRL_CCPATIENT.CLNT_ID;
ELSE
LIST_BILL_TYPE(I):=0;
LIST_PATPAY(I) :='Y';
LIST_CLNT_ID(I) :=1;
END IF;
-- V_CHECKEXIST:=V_CHECKEXIST+1;
NEXT_RECORD;
ELSE
NEXT_RECORD;
END IF;
END LOOP;
Sunday, September 16, 2018
logon page center window.
11:29 PM
No comments
Call procedure in when new form instance
CENTER_FORM('WINDOW1',0);
PROCEDURE CENTER_FORM(MyWindowName IN varchar2,UpperMargin IN number) IS
x number(6);
y number(6);
BEGIN
SET_WINDOW_PROPERTY(FORMS_MDI_WINDOW,TITLE,'India');
Set_window_property(forms_mdi_window,window_state,maximize);
x:=((get_window_property(forms_mdi_window,width)-get_window_property(MyWindowName ,width))/2);
y:=((get_window_property(forms_mdi_window,height)-get_window_property(MyWindowName ,height))/2+UpperMargin);
set_window_property(MyWindowName , position,x,y);
END;