Jumat, 26 Juni 2009

Adding Lookup table in oracle

Adding a Lookup Table to Your Application
You have also done the steps in this section before, so you can go through them quickly this time through.
1. Return to your application and click on the master-detail page.
2. Click on the item for CUSTOMER_NAME.
You will want to make three changes to the attributes of this field.
3. In the Name section of the page, change the Display As value to Select List by clicking on
the Select List link below the field.
4. Click on Source at the top of the page to isolate the attributes of the item.
You can see that this item is bound to the CUSTOMER_NAME column in the ORDERS table. If you tried to
run this page now, you would get an SQL error, since this column no longer exists in that table. You
have to change the source of the item, and you could also change the name of the item to reflect the new
source. For the sake of simplicity, the examples in this book will leave the name of the item as it stands.
Change the Source value or expression to CUSTOMER_NAME_ID, the name of the new column
in the ORDERS table.
6. Click the LOV button to bring up the section of the attributes concerning LOVs.
7. Click on the Create Dynamic List Of Values link at the bottom of the section.
8. In the wizard for creating dynamic LOVs, accept the default schema and click Next.
9. Select the CUSTOMERS table in the next page, and click Next.
10. Select CUSTOMER_NAME as the Display Column and CUSTOMER_NAME_ID as the Return
Value, and click Next.
11. Accept the generated SQL, and click Finish. Click Apply Changes.
You have added the LOV to the edit page for the ORDERS table. As with the use of the lookup table in the
previous chapters, you will also want to add the new column to the initial report by modifying the SQL
source for that report.
12. Return to the main development page for the application, and click on the initial interactive
report created for the ORDERS table. If you are doing the exercises for this book in order, this
page should be Page 1.
13. Click on the Region Definition tab.
14. Change the SQL in the Source section from:
select
“ORDER_ID”,
“ORDER_TIMESTAMP”,
“CUSTOMER_NAME_ID”,
from “ORDERS”
to the following code:
select
“ORDER_ID”,
“CUSTOMERS”.”CUSTOMER_NAME”,
“ORDER_TIMESTAMP”
from “ORDERS”, “CUSTOMERS”
where “ORDERS”.”CUSTOMER_NAME_ID” = “CUSTOMERS”.”CUSTOMER_NAME_ID”