Region sql query(updateable report) data entry in non db columns
In a tabular report type updateable report
What is the best way to provide data entry into a non db column a) (to accept parameters for some on demand pl/sql processes)?
Only when setting a) as a standard report column the db insert/update transaction can be processed
When changing a) to text field the db insert/update transaction fails with en error (screen/db are not in sync which is not actually the case)
a) should not be part of the db insert/update transactions but still allow data entry
How can this be achieved?
Thanks
Peter
Hi Peter,
I think the easiest solution is to use an updateable view instead of the direct table access.
Here is an example:
CREATE OR REPLACE VIEW V_EMPLOYEES
AS
SELECT EMPLOYEE_ID
, FIRST_NAME
, LAST_NAME
, FIRST_NAME||' '||LAST_NAME AS FULL_NAME
FROM EMPLOYEES
CREATE OR REPLACE TRIGGER TRG_V_EMPLOYEES
INSTEAD OF INSERT OR UPDATE OR DELETE
ON V_EMPLOYEES
REFERENCING NEW AS new OLD AS old
FOR EACH ROW
BEGIN
IF UPDATING
THEN
UPDATE EMPLOYEES
SET FIRST_NAME = :new.FIRST_NAME
, LAST_NAME = :new.LAST_NAME
WHERE EMPLOYEE_ID = :old.EMPLOYEE_ID
-- insert and delete is not allowed
ELSIF INSERTING
THEN
NULL; -- there would be a insert code
ELSIF DELETING
THEN
NULL; -- there would be the delete code
END IF;
END;
/FIRST_NAME||' '||LAST_NAME AS FULL_NAME in the example view simulates your function call.
There might be a possibility to do it in APEX as well, but that was the first solution which came into my mind.
Patrick
Check out my APEX-blog: http://inside-apex.blogspot.com
Check out the ApexLib Framework: http://apexlib.sourceforge.net
Similar Messages
-
SQL Query (updateable report) Region - Conditionally Hide and Set Values
SQL Query (updateable report) Region - Conditionally Hide and Set Values
Outline of requirement :-
Master / Detail page with Detail updated on same page using SQL Query (updateable report).
The detail region has the following source
SELECT item_id,
contract_id,
CASE WHEN hardware_id IS NOT NULL THEN
'HA'
WHEN backup_dev_id IS NOT NULL THEN
'BD'
WHEN hardware_os_id IS NOT NULL THEN
'HS'
END item_type,
hardware_id,
backup_dev_id,
hardware_os_id
FROM "#OWNER#".support_items
WHERE contract_id = :P26_CONTRACT_IDThe table support_items implements arced relationships and has the following columns
CREATE TABLE SUPPORT_ITEMS
ITEM_ID NUMBER NOT NULL,
CONTRACT_ID NUMBER NOT NULL,
HARDWARE_ID NUMBER,
BACKUP_DEV_ID NUMBER,
HARDWARE_OS_ID NUMBER
)A check type constaint on support_items ensures that only one of the fk's is present.
( hardware_id IS NOT NULL
AND backup_dev_id IS NULL
AND hardware_os_id IS NULL
OR ( hardware_id IS NULL
AND backup_dev_id IS NOT NULL
AND hardware_os_id IS NULL
OR ( hardware_id IS NULL
AND backup_dev_id IS NULL
AND hardware_os_id IS NOT NULL
) Hardware_Id is a FK to Hardware_Assets
Backup_dev_id is a FK to Backup_Devices
Hardware_os_id is a FK to Hardware_op_systems
The Tabular Form Element based on item_type column of SQL query is Displayed As Select List (based on LOV) referencing a named list of values which have the following properties
Display Value Return Value
Hardware Asset HA
Backup Device BD
Computer System HSThe Tabular Form Elements for the report attributes for hardware_id, backup_dev_id and hardware_os_id are all Displayed As Select List (Based on LOV).
What I want to do is only display the Select List for the FK depending on the value of the Select List on Item Type, e.g.
Item_Type is 'HA' then display Select List for hardware_id, do not display and set to NULL the Select Lists for backup_dev_id and hardware_os_id.
Item_Type is 'BB' then display Select List for backup_dev_id, do not display and set to NULL the Select Lists for hardware_id and hardware_os_id.
Item_Type is 'HS' then display Select List for hardware_os_id, do not display and set to NULL the Select Lists backup_dev_id and hardware_id.
There are properties on elements to conditionally display it but how do we reference the values of the SQL query Updateable region? they are not given a page item name?
Also on the Tabular For Elements there is an Edit tick against a report item - however when you go to the Column Attributes there is not a property with which you can control the Edit setting.
What's the best way of implementing this requirement in APEX 3.1?
Thanks.>
Welcome to the forum: please read the FAQ and forum sticky threads (if you haven't done so already), and update your profile with a real handle instead of "user13515136".
When you have a problem you'll get a faster, more effective response by including as much relevant information as possible upfront. This should include:
<li>Full APEX version
<li>Full DB/version/edition/host OS
<li>Web server architecture (EPG, OHS or APEX listener/host OS)
<li>Browser(s) and version(s) used
<li>Theme
<li>Template(s)
<li>Region/item type(s) (making particular distinction as to whether a "report" is a standard report, an interactive report, or in fact an "updateable report" (i.e. a tabular form)
With APEX we're also fortunate to have a great resource in apex.oracle.com where we can reproduce and share problems. Reproducing things there is the best way to troubleshoot most issues, especially those relating to layout and visual formatting. If you expect a detailed answer then it's appropriate for you to take on a significant part of the effort by getting as far as possible with an example of the problem on apex.oracle.com before asking for assistance with specific issues, which we can then see at first hand.
I have a multi-row region that displays values and allows entries in a number of fields.Provide exact details of how this has been implemented. (An example on apex.oracle.com is always a good way to do this.)
I should like the fields to be conditional in that they do not permit entry, but still display, if certain conditions apply (e.g. older rows greyed out). Can this be done? Almost anything can be done, often in multiple ways. Which are appropriate may be dependent on a particular implementation, the skills available to implement it, and the effort you're willing to expend on it. Hence it's necessary to provide full details of what you've done so far... -
Validation of a Region defined as type SQL QUERY (Updateable Report)
Hi,
I am trying to perform some validation on a Region defined as type SQL QUERY (Updateable Report). The report has two columns.
One of the columns is a Select List and I would like to insure that a user cannot select the same value twice
in the report. For example, if the select list has 5 values, A, B, C, D, E, I don't want a user to be able to select
B twice in the report. I am assuming that I will need to incorporate javascript
into my validation logic in order to perform this task. If so, could someone provide some guidance? Or are there
other alternatives.
Thanks in advance,
MichaelDan,
Sorry, I didn't mean to post the question twice. I was trying to edit my original question. Thanks for the link to the website. I am new to APEX development so the website you gave me will be extremely useful to learn new development techniques.
Thanks again,
Michael -
Create a validation for SQL Query (updateable report)
Hello
I have a need for creating a validation on a SQL Query (updateable report)- type region
1)
When a row get populated i don't want same values to be populated in the second row.(as shown in first 2 rows)
Also, I don't want to have a value that falls in range in between 100 and 1000 for the period falls in the previous. (as shown in third row)
i.e
Type_id
Lower_Limit Upper_Limit Date_From Date _To
1
100 1000 1/1/2013 12/31/2013
2
100 1000 1/1/2013 12/31/2013
3
101 500 2/1/2013 10/31/2013
appreciate any help
thanks
kpThis example could help:
http://apex.oracle.com/pls/otn/f?p=31517:214
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://apex.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------- -
Setting the cell width in a Tabular Form (SQL Query (updateable report) )
version 3.2.1
I have a Tabular Form (SQL Query (updateable report) ) and I have a column that is a VARCHAR2(4000) that when displayed extends the cell to the full length (which of course makes sense).
How can I set the width of this cell to something like 30 or 50 and wrap the contents?
Thanks,
JoeScott,
Thank you for replying.
Your suggestion kinda worked. I say kinda because when the report is first displayed the cell is the full width and appears to ignore the width setting. There is a Select List on the report to restrict some of the data that is displayed. When a selection is made from this Select List, it appears that the cell width is then adjusted to what was set, but not for every selection from this Select List.
I made the width entry in Tabular Form Element - Element Width
Any idea why the width setting is ignored?
Thanks,
Joe -
SQL Query (updateable report) - Can't figure out how to make one
Hi folks,
Can someone tell me how to make a report where the data can be updated? Not an interactive report, a SQL report that selects only one row. The only options in the drop down I see are "SQL Query" and "SQL Query (PL/SQL function body returning SQL query)", but I have a report elsewhere that says it's type is "SQL Query (updateable report)", but I can't remember how to do it :(
Thanks very much,
-AdamHi Adam,
An Updatable Report is a "Tabular Form" - see: http://download.oracle.com/docs/cd/E10513_01/doc/appdev.310/e10497/frm_tabular.htm#CHDFBHDB
Andy -
Type: SQL Query (updateable report)
Hello,
Is it possible to default a field value in a SQL Query (updateable report) Report Region in a DML Form when the 'Add Row' button is clicked? I want to default some List of Value fields. This is not as simple as a HTML Region Item based on a table, there is a 'Default' tab where the field value goes. Any help is appreciated, thanks.Hi,
On the tabular form's Column Attributes tab, select the column. You should see a section headed "Tabular Form Element". In there, there are two settings you can use: Default Type and Default
Andy -
Sql Query(Updateable Report) with pagination
Hi,
We're on APEX 3.2 I have a question on Sql Query(Updateable Report) and pagination. I have an updateable report which we have set to show 20 rows. When the userwhi has more than 20 rows enters the data and clicks next the data disappears. I have been reviewing other posts, but haven't come to a clear conclusion on how to prevent this from happening. I have been trying to use javascript to show a save popup when clicking 'Next' Any help is appreciated.
Thanks,
Joeany ideas?
-
Update Field On Change For A SQL Query (updateable report)
Hi,
I'd like to request help from anyone with ideas on how to solve this.
We are using APEX 4.2, 10GR2, RedHat5.
I have a report that comes from SQL Query (updateable report).
I'm using the apex_item.text and apex_item.hidden on fields.
I'm using a button to submit and after submit process to add some logic that I need.
There could be 1 - 10 records in the report.
There is only 1 field that is needed to enter a value, but the value of this field determines the value of another field.
I think that I can do this with a submit button and an after submit process where I loop through all the records. I think I have this handled.
This is the question
When the value of that field is changed then the value of another field in the same row changes immediately.
Is this possible?
All the examples I've seen so far are for a single record and that doesn't work for us.
I guess this is a MRU process but I haven't seen an example where a dynamic action is possible on a Multi Row Update.
Could anyone direct me to where I can see an example or help me get directions?
I appreciate all your help an comments and I thank you in advance.Yes why not...what you looking for is a ajax call
See {message:id=10390979}
Please note:-you can also do this as a dynamic action as shown below
Event: Change
Selection type: jQuery Selector
jQuery Selector: input[name="f01"]
True action with Execute JavaScript Code and put all code inside the test funtion, you may need to amend the code to use this.triggeringElemnt in place of this -
APEX 4.1, SQL Query(Updateable report), Validation issue.
Hi,
I am using APEX 4.1.
I have SQL Query(Updateable report), we have created validation for the columns in this report.
The validations are working properly only for the first row of the report on submitting, the remaining rows are not getting validated.
If we check mark the rows it will get validated, but we want the validation to happen without checkmarking, on all the rows on clicking submit button.
Can someone help me to fix this issue?
Thanks in advance.
Thanks & regards,
Ravi.Hi Ravi,
Welcome to Oracle Forums!
Please acquaint yourself with the FAQ and forum etiquette if you haven't already done so.
Always state
<ul>
<li>Apex Version</li>
<li>DB Version and edition</li>
<li>Web server used.I.e. EPG, OHS, ApexListner Standalone or with J2EE container</li>
<li>When asking about forms always state tabular form if it is a tabular form</li>
<li>When asking about reports always state Classic / IR</li>
<li>Always post code snippets enclosed in a pair of {code} tags as explained in FAQ</li>
</ul>
I am using APEX 4.1.I have SQL Query(Updateable report), we have created validation for the columns in this report.
The validations are working properly only for the first row of the report on submitting, the remaining rows are not getting validated.
If we check mark the rows it will get validated, but we want the validation to happen without checkmarking, on all the rows on clicking submit button.
Can someone help me to fix this issue?
>
Post your validation code with some explanations of what the g_fnn are.
Cheers, -
Problem With SQL Query (updateable report)
Hi,
I have a report which I have set as type 'SQL Query (updateable report)'. I have added a 'row selector' to the report but when I run it I get the following error message:
failed to parse SQL query:
ORA-00904: "COL60": invalid identifier
The report works fine if I remove the row selector. Any ideas as to why the error is being produced?
Cheers
SimonI don't have the apex_application.g_f01(i) referenced in the page source...In the page source you wouldn't find anything by that name
Identify the tabular form's checkbox column in the page(firebug/chrome developer panel makes this easy)
It should be like
<input id="..." value="" type="checkbox" name="fXX" >we are interested in the name attribute , get that number (between 01 and 50)
Replace that number in the code, for instance if it was f05 , the code would use
apex_application.g_f05
--i'th checked record' primary keyWhen you loop through a checkbox array, it only contains the rows which are checked and it is common practice to returns the record's primary key as the value of the checkbox(available as the the i'th array index as apex_application.g_f05(i) , where i is sequence position of the checked row) so that you can identify the record. -
SQL Query updateable report with row selector. Update process.
I have a SQL Query updateable report with the row selector(s).
How would I identify the row selector in an update process on the page.
I would like to update certain columns to a value of a select box on the page.
Using the basic:
UPDATE table_name
SET column1=value
WHERE some_column=some_value
I would need to do:
UPDATE table_name
SET column1= :P1_select
WHERE [row selector] = ?
Now sure how to identify the [row selector] and/or validate it is checked.
Thanks,
BobI don't have the apex_application.g_f01(i) referenced in the page source...In the page source you wouldn't find anything by that name
Identify the tabular form's checkbox column in the page(firebug/chrome developer panel makes this easy)
It should be like
<input id="..." value="" type="checkbox" name="fXX" >we are interested in the name attribute , get that number (between 01 and 50)
Replace that number in the code, for instance if it was f05 , the code would use
apex_application.g_f05
--i'th checked record' primary keyWhen you loop through a checkbox array, it only contains the rows which are checked and it is common practice to returns the record's primary key as the value of the checkbox(available as the the i'th array index as apex_application.g_f05(i) , where i is sequence position of the checked row) so that you can identify the record. -
Change "SQL Query" report to "SQL Query (updateable report)" report?
I manually made a report, because the tabular report made by the wizard gave me no possibility to use a popup LOV. Now I have this report, but I cant apply an MRU process on it, becuase it's not an "SQL Query (updateable report)". How can I change my report to a "SQL Query (updateable report)"? I only can choose between SQL Query and SQL QUERY (PL/SQL function body returning SQL query).
Hi Tom
You can just write the processes yourself. Although trickier this can give you a lot more control over row processing.
APEX_APPLICATION.G_F01, F02 etc are global variables in the apex_application package that are defined as arrays.
These are regularly used in tabular forms to reference values within them. The normal ordering would be column 1 = G_F01, column 2 = G_F02 etc etc. Although you can change these and even assign more than one column to an array.
The example
FOR i IN 1..APEX_APPLICATION.G_F01.COUNT LOOP
INSERT INTO my_table VALUES(:P1_EMPID , APEX_APPLICATION.G_F01(i));
END LOOP;Is saying - for the number of values in the array G_F01 (probably column 1) loop insert into the table the value of the associated value in the array. So first time through i=1 - so the first value in the array (probably row 1 in column 1), next time i=2 so the second value in the array is used (probably row 2 in column 1) and so on...
When you've created a manual tabular form (what I would call what you've done) you have created the items using the APEX_ITEM package in your query. The first parameter for this is p_idx which defines which global array to hold it in.
Cheers
Ben -
Possible APEX BUG - Export to CSV from SQL Query (updateable report)
I'm getting a the following sql error - just by enabling the Export to a CSV file from a SQL Query (updateable report) and selecting the export link - anyone have an idea what I could as a workaround?
ORA-06550: line 1, column 45: PLS-00103: Encountered the symbol "1" when expecting one of the following: begin case declare exit for goto if loop mod null pragma raise return select update while with <an identifier> <a double-quoted delimited-identifier> <a bind variable> << close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe
Error ERR-1000 Unable to determine LOV from "declare function x return varchar2 is begin 1 Not Checked;1 Not Checked,2 Review Passed;2 Review Passed,3 Reviewed w/ Issues;3 Reviewed w/ Issues,4 Not Applicable;4 Not Applicable return null; end; begin wwv_flow_utilities.g_query := x; end;".
OK
report error:
ORA-20001: Error fetching column value: ORA-20001: Query must begin with SELECT or WITHFrank,
I received your email with this same question so I'll just respond here. Our internet-facing hosted site apex.oracle.com allows you to request a workspace and, after the request is approved and the workspace provisioned, to develop applications there. If you already have an application that you need some help with, you can import/install it into your workspace on apex.oracle.com. This makes it easy to demonstrate problems to others who might be able to help.
Sometimes it will be necessary for you to create developer accounts in your workspace in order for others to use your Application Builder. You can post usernames/passwords here or you can convey those privately to those offering their services. In either case, you'd want to remove or disable those accounts as soon as the problem is resolved. For problems that I ask to see demonstrated on apex.oracle.com, it is not necessary for you to create an account for me. I can do that as our group runs the site. I just need to know your workspace name and application ID.
Scott -
SQL Query (updateable report) CheckBox Update Problem
My process will update 1 or 2 rows, but fails on three or more rows. All the rows on the page can be processed, up to 2 at a time.
The SQL Query Report can have 50 rows on a page. Only the check box and the hidden primary key column are returned by the report to the process (marked as edit).
If I issue the update myself, I can update any number of rows with no error.
If I change the update SQL to a select, it works for the all of the checked lines (the correct count is displayed in the process message.
The only thing I see for the failure is a url
http://d101dbaxeaa2llb:10700/apex/wwv_flow.accept
Process is:
DECLARE
vRow BINARY_INTEGER;
item NUMBER;
BEGIN
item := 0;
FOR i IN 1 .. apex_application.g_f01.COUNT
LOOP
item := item + 1;
vRow := apex_application.g_f01(i);
update #OWNER#.B_ATT_DAYS_FUT
set day_status_cd =
case
when day_status_cd = -1 and day_dt is not null then 2
when day_status_cd = -1 and day_dt is null then 0
when day_status_cd = 6 then 7
else 2
end
where days_pk = to_number(apex_application.g_f02 (vRow));
END LOOP;
:P35_CHECKED_CT := item;
END;
This is in APEX Application Express 3.1.0.00.32 on Oracle 11.1.0.6.0.Query is at the end. The Report Regions is a SQL Query (Updatable Report).
I don't thinks this is my code problem.
The system I'm using is dieing. It has had two disk crashes, which spinrite brought back. I've restored from a partition image and a full cold backup. Then I've had a number of blue screen failures. One of the DBAs working for me rebuilt the 11g instance on a VM and restored the cold backup. Everything runs fine there. I even applied the latest code export from the failing systems development workspace to the VM based system. Still runs fine.
There are a number of abends in the alert log ORA-07445 and ORA-21779 for which our on-site ASC Engineer has opened a TAR/SR. I suspect that some part of one of the FLOW tablespaces was damaged, a part which deals with runtime APEX. Build time is running fine. Application just does not, either as a runtime or in the development system.
We are moving to a new AIX server, just finishing the setup and then I can send over the exports. That should put this to bed.
SELECT
DAYS_PK
, NAME_TX
, DAY_CD
, DAY_DESC_TX
, DAY_STATUS_CD
, DAY_STATUS_DESC_TX
, DAY_DT
, REASON_TX
, TEN_DAY_PERIOD_FL
, EARNED_ON_DT
, EXPIRES_ON_DT
, PLANNED_ON_DT
, GUARANTEED_DAY_CD
, GUARANTOR
FROM
(SELECT
DAYS."DAYS_PK"
, A_ATT_USERS.NAME_TX
, DAYS."DAY_CD"
, DAY_CD."DAY_DESC_TX"
, DAYS."DAY_STATUS_CD"
, DAY_ST_CD."DAY_STATUS_DESC_TX"
, DAYS."DAY_DT"
, DAYS."REASON_TX"
, DAYS."TEN_DAY_PERIOD_FL"
, DAYS."EARNED_ON_DT"
, DAYS."EXPIRES_ON_DT"
, DAYS."PLANNED_ON_DT"
, CASE DAYS."GUARANTEED_DAY_CD"
WHEN 'E' THEN 'GUARANTEED'
WHEN 'R' THEN 'GUARANTOR'
ELSE NULL
END GUARANTEED_DAY_CD
, G_ATT_USERS.NAME_TX "GUARANTOR"
FROM
"B_ATT_DAYS_FUT" DAYS
LEFT OUTER JOIN "A_ATT_USERS" G_ATT_USERS
ON
"DAYS"."GUARANTEED_COMIT_ID" = "G_ATT_USERS"."COMIT_ID"
LEFT OUTER JOIN "A_ATT_USERS"
ON
"DAYS"."COMIT_ID" = "A_ATT_USERS"."COMIT_ID"
, "T_ATT_DAY_CD" DAY_CD
, "T_ATT_DAY_STATUS_CD" DAY_ST_CD
WHERE
DAYS."DAY_CD" = DAY_CD."DAY_CD"
AND DAYS."DAY_STATUS_CD" = DAY_ST_CD."DAY_STATUS_CD"
AND DAYS.COMIT_ID IN
SELECT DISTINCT
( R.COMIT_ID )
FROM
ATT_ATTENDANCE.A_ATT_STAFF_ROLE R
WHERE
R.COMIT_ID <> :P1_COMIT_ID_HIERARCHY START
WITH R.COMIT_ID = :P1_COMIT_ID_HIERARCHY
CONNECT BY PRIOR R.COMIT_ID = R.MGR_COMIT_ID
AND DAYS.DAY_STATUS_CD IN ( 1, -1, 6 )
AND DAYS.COMIT_ID <> :P1_COMIT_ID
ORDER BY
A_ATT_USERS.NAME_TX
, DAYS.DAY_DT
, DAYS.DAY_CD DESC
, DAYS.EARNED_ON_DT)
WHERE
INSTR(UPPER(NAME_TX),UPPER(COALESCE(:P35_S_NAME,NAME_TX))) > 0
Maybe you are looking for
-
Exchange 2010 SP3 Create Dynamic DL for Direct Reports
I am not sure this is possible but if there is a will there is a way I guess. System: Exchange 2010 SP3 on Windows Server 2008 R2 I am trying to see if there is a way to create dynamic DLs for Manager(s) direct reports. Example: Manager has 5 people
-
How to recover IDSM-2 password (without know any password)
Hi, We have a IDSM-2 system card in 6500 system. Unfortunately, we lost tracking the login/password. I have read Cisco doc# 13837. It req to know either admin username/password or service username/password to do password recovery. I do not have those
-
How can I create additional or sub "Sent Mail" folders so that I can organize my sent mail along the same lines as the inbox? I use Mail v 4.5.
-
Quicktime doesn't work after Itunes install
After installing Itunes 7.0.2, I suddenly can't view Quicktime files. I had Quicktime installed before, but obviously it was overwritten when I installed Itunes. Now, when I attempt to view any .mov files, the audio is played, but the video is a scra
-
SELECTINPUT on a userdefined dimension for a package stored in a team
Hello Experts, I have a case where a datamanager package selectinput prompt works fine while the package is stored in "COMPANY". The prompt constains a referral to a userdefined diimension called VERSION. the dimensions available for selection in the