Here is something we want to achieve using aliases in DB2 (if possible).
We have different business verticals which want to share a common data. For example, let's assume in a banking company the Loan Deppt and the Credit card deppt want to use the same customer information. we may assume the data specific to the Loan deptt is on a different database, Crdit card data is on a different database. However, the need to access the same customer data.
Technically, if I have a program, which is used to access both Loan data and customer data, how do I achieve this?
QUALIFIER1.LOAN_TABLE (SSID: ABCD)
QUALIFIER2.CUSTOMER_TABLE (SSID: ABCD)
PROGRAM.
EXEC SQL
SELECT FROM LOAN_TABLE
..........
........
END-EXEC
and also EXEC SQL
SELECT FROM CUSTOMER_TABLE
................
...............
EXEC SQL
Both these tables are on the same subsystem? Is there a way I can direct the program to read data from QUALIFIER2 ONLY FOR Customer data? Is it possible using Aliases? How do I Bind the program?
Thanks
BM
yes, you can use aliases.
If your program is bound with QUALIFIER1, then you need
CREATE ALIAS QUALIFIER1.CUSTOMER_TABLE FOR QUALIFIER2.CUSTOMER_TABLE
But you can also use the same qualifier for tables in different databases.
Best wishes,
Ulrike
QUALIFIER3.LOAN_TABLE
QUALIFIER3.CUSTOMER_TABLE
Then, in your bind, you could reference QUALIFIER3 in the QUALIFER list.
Most likely, your DBA will have to create these aliases, and should be pretty familiar with how the BIND would look. We used it quite a bit there.