I have 3 tables: Table A, Table B and Table C
Each table have policy number and from number.
What I want to do is combine these three table
and generate a report like this:
Example Policy P-4404 has "Y" under column F350.0 to mean that yes this policy has this form number
blank means this policy does not have this form number.
I am dealing with only 4 form numbers.
I need a script in oracle to get this type of result. Is it possible?
Thank you.
Al
report to look like this:
Pol_NO, F350.0, F353.0, F353.1, F555.5
------ ------ ------ ------ ------
P-4404, Y, Y, Y, Y
P-0600, Y, Y, Y,
P-0603, Y, Y
P-6171, Y
----
-- Script to create 3 table and insert sample data
CREATE TABLE SIMDATA.TABLE_A
(
POL_NUM VARCHAR2(9 BYTE),
FORM_NUM VARCHAR2(10 BYTE)
);
CREATE TABLE SIMDATA.TABLE_B
(
POL_NUM VARCHAR2(9 BYTE),
FORM_NUM VARCHAR2(10 BYTE)
);
CREATE TABLE SIMDATA.TABLE_C
(
POL_NUM VARCHAR2(9 BYTE),
FORM_NUM VARCHAR2(10 BYTE)
);
---DATA
SET DEFINE OFF;
Insert into SIMDATA.TABLE_A
(POL_NUM, FORM_NUM)
Values
('P-4404', 'F350.0');
Insert into SIMDATA.TABLE_A
(POL_NUM, FORM_NUM)
Values
('P-0600', 'F350.0');
Insert into SIMDATA.TABLE_A
(POL_NUM, FORM_NUM)
Values
('P-0603', 'F350.0');
Insert into SIMDATA.TABLE_A
(POL_NUM, FORM_NUM)
Values
('P-6171', 'F350.0');
Insert into SIMDATA.TABLE_A
(POL_NUM, FORM_NUM)
Values
('P-6533', 'F350.0');
COMMIT;
----TABLE B
SET DEFINE OFF;
Insert into SIMDATA.TABLE_B
(POL_NUM, FORM_NUM)
Values
('P-4404', 'F353.0');
Insert into SIMDATA.TABLE_B
(POL_NUM, FORM_NUM)
Values
('P-4404', 'F353.1');
Insert into SIMDATA.TABLE_B
(POL_NUM, FORM_NUM)
Values
('P-0600', 'F353.1');
Insert into SIMDATA.TABLE_B
(POL_NUM, FORM_NUM)
Values
('P-0600', 'F353.0');
Insert into SIMDATA.TABLE_B
(POL_NUM, FORM_NUM)
Values
('P-5283', 'F353.1');
Insert into SIMDATA.TABLE_B
(POL_NUM, FORM_NUM)
Values
('P-0603', 'F353.0');
COMMIT;
---TABLE C
SET DEFINE OFF;
Insert into SIMDATA.TABLE_C
(POL_NUM, FORM_NUM)
Values
('P-4404', 'F555.5');
Insert into SIMDATA.TABLE_C
(POL_NUM, FORM_NUM)
Values
('P-9022', 'F555.5');
Insert into SIMDATA.TABLE_C
(POL_NUM, FORM_NUM)
Values
('P-2613', 'F555.5');
COMMIT;
Our community of experts have been thoroughly vetted for their expertise and industry experience.
This award recognizes a member of Experts Exchange who has made outstanding contributions to the community within their first year as an expert. The Rookie of the Year is awarded to a new expert who has the highest number of quality contributions.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.