Thelnternet
Thelnternet

Reputation: 174

APEX 4.1 SQL Query using a page item to define FROM

I am trying to utilize a single tabular form to handle a couple minor tables since I cannot have multiple updateable reports on a single page. The easiest way I could figure to adjust what table I was modifying was to use a select list to choose which table I am viewing/editing.

The select list contains a display of "Supervisor" and "School" resulting in SUPERVISOR and SCHOOL respectively

the items name is P8_TABLE

Region Source:

select *
from #OWNER#."G06_" || :P8_TABLE

The tables are named G06_SUPERVISOR and G06_SCHOOL

However the query returns: ORA-00933: SQL command not properly ended

Upvotes: 0

Views: 134

Answers (2)

brenners1302
brenners1302

Reputation: 1478

You cant make a tabular form query source dynamic. And since the two tables you want to be displayed and be updatable doesnt have common number and usage of their columns, the only way I can think of is separating the two tables and diplaying one tabular form for each table. Though, Apex 4.1 or even the latest Apex 5 doesnt allow multiple tabular form, you can make this possible by using javascript's iframe. You'll need to use javascript since you want to modify the interface of the report/page.

Upvotes: 1

Littlefoot
Littlefoot

Reputation: 142705

I'm afraid that this won't work. As far as I can tell, tabular form is to be based on one table only (i.e. you can't have a JOIN in there; even if you're displaying values from some other table, you'd rather create functions which would return those values).

That being said, principle you'd like to use means that tabular form underlying table is unknown (as it can vary, depending on what you select in P8_TABLE select list item), which - in turn - means that column names also differ (unless all of those tables share the same column list).

If we presume that above is correct, then I'd suggest you to abandon that approach and maintain every "minor table" on its own tabular form page. It will be just a little bit more typing & clicking, but I wouldn't worry about it.

Hopefully, someone else knows how to do it the way you'd want it to.

Upvotes: 1

Related Questions