Bug: updating a view with a CLOB column results in ORA-01461
Here is a database script to create a table and a view:
CREATE TABLE TEST_CLOB(ID NUMBER, TEXT CLOB);
CREATE OR REPLACE VIEW VTEST_CLOB AS
SELECT ID, TEXT FROM
SELECT ID, TEXT
FROM TEST_CLOB
WHERE ID IN (SELECT 1 FROM DUAL)
The following code throws ORA-01461: can bind a LONG value only for insert into a LONG column.
static void Main()
using (var conn = new OracleConnection(ConnectionString))
conn.Open();
var trans = conn.BeginTransaction();
var cmd = conn.CreateCommand();
cmd.BindByName = true;
var p = new OracleParameter("vText", new string('a', 4001));
cmd.Parameters.Add(p);
cmd.CommandText = "UPDATE vTEST_ClOB set TEXT = :vText";
cmd.ExecuteNonQuery();
trans.Rollback();
Please create a table and a view exactly as shown above.
The error doesn't happen when updating TEST_CLOB table itself or if the view is created as follows:
CREATE OR REPLACE VIEW VTEST_CLOB AS
SELECT ID, TEXT FROM
SELECT ID, TEXT
FROM TEST_CLOB
WHERE ID IN (1)
This code was tested with ODP.NET version 4.112.3.0 and ODP.NET Managed Beta2 version 4.112.3.60.
Oracle 11g Release 11.2.0.2.0 64-bit.
When constructing OracleParameter like this: var p = new OracleParameter(name, stringValue), OracleDbType property is always set to OracleDbType.Varchar2,
but I think it should take into accout the size of the stringValue and change it to OracleDbType.Clob automatically.
I've noticed similar behavior with byte arrays.
Parameters with byte[] data longer than 4000 bytes are treated as RAW or LONG RAW type values (not sure which one exactly).
Explicitly setting parameter type to OracleDbType.Blob works around this problem.
Also, it's very strange that these errors don't seem to occur on tables, only views are affected.
Any thoughts on this please?
Similar Messages
-
Updatable View issues: cannot select FOR UPDATE from view with DI
Hi All,
I have a simple view XY and an instead of trigger on that to insert data into one table which is used in the my view. When I do insert statement on view XY it is working fine from sql but when i used same thing with page process of " Process Row of XY Automatic Row Processing (DML) " i am getting following error. I am using APEX 3.0 . Please help me.
ORA-20001: Error in DML: p_rowid=xxxx, p_alt_rowid=abc, p_rowid2=, p_alt_rowid2=. ORA-02014: cannot select FOR UPDATE from view with DISTINCT, GROUP BY, etc.
ThanksJames,
are you already on 3.0.1.00.07 or 3.0.1.00.08? Have a look at the release notes, it says something about a bug fix for some occurrences of ORA-02014.
Also have a look at the new substitution value/item FSP_DML_LOCK_ROW which turns locking off if you set it to FALSE. See http://www.oracle.com/technology/products/database/application_express/html/3.0.1_readme.html#CHDIDIAF and also http://download-west.oracle.com/docs/cd/B32472_01/doc/appdev.300/b32471/advnc.htm#BCGFDAIJ
Patrick
My APEX Blog: http://inside-apex.blogspot.com
The ApexLib Framework: http://apexlib.sourceforge.net
The APEX Builder Plugin: http://apexplugin.sourceforge.net/ New! -
How do I update a view with a join
I have a module with database block based on a view with joins, so I am not able to perform insert, update & delete directly.
Therefore I created an unbound item that can be changed. The relevant database record is searched and updated.
So, with above work around, insert, update & delete is possible.
This works just fine.
Now, the 'save icon' in the menu (diskette icon), does not get activated automatically when there are changes to be saved. This is because the view is not changed.
So, I enable the 'save icon' manually in the when-validate-item trigger. But now when I navigate to another record, the 'save icon' gets de-activated by QMS/headstart code. This is because the view is not changed.
So, I tried set_record_property (CHANGED_STATUS) to let the application
know there are changes to be saved.
But then, I get an error:
* FRM-40654: Record has been updated by another user. Re-query block to see
change.
What is the proper way to handle this problem?
nullPeter,
I think you've gone down the wrong track with your workaround.
You should base your form on the view and allow update and insert to the view just as if it was a table.
If you are using Oracle 8i, create an INSTEAD-OF trigger on the view in the database which redirects the DML to insert or update the appropriate table(s) instead of the view.
If you are pre Oracle 8i, in the form you can create on-insert, on-update, and on-delete triggers to redirect the DML to the appropriate table.
The only other tricky situation comes if you have items in your form that are server-derived (in the TAPI) of the table(s) in question. If so, you must explicitly code the form to retrieve these server-derived values. Also note that with a view, you cannot have a server derived primary key since there would be no way to retrieve it in the form. (Views don't have a rowid.) You must derive primary key columns in the form when the form is based on the view.
Regards,
Lauri -
Update XML data stored in CLOB Column
Hi All,
i am new to Oracle and new to SQL
i am trying to update XML data stored in CLOB cloumn,data is stored with the follwoing format
<attrs><attr name="name"><string>Schade</string></attr></attrs>
i am using the following query for updating the value
UPDATE PRODUCT p SET ATTRIBUTES_nl_nl=UPDATEXML(XMLTYPE.createXML(ATTRIBUTES_nl_nl),'/attrs/attr[@name="name"]/string/text()','Schade').getClobVal() WHERE p.sku='000000000000040576_200911-5010057'
this query is working fine but it changing the data to the following format
<attrs><attr name="name">Schade</attr></attrs>
some how it is ommiting the <string> tag from it, i am unable to figure it out whats the reason.
any help in this regard will b e much appriciated
Thanks in Advance
-UmeshHi,
You should have created your own thread for this, and included database version.
This works for me on 11.2.0.2 and 10.2.0.5 :
SQL> create table t_org ( xml_clob clob );
Table created
SQL>
SQL> insert into t_org
2 values(
3 '<Message>
4 <Entity>
5 <ASSIGNMENT>
6 <OAVendorLocation> </OAVendorLocation>
7 <Vendorid>1</Vendorid>
8 </ASSIGNMENT>
9 </Entity>
10 </Message>'
11 );
1 row inserted
SQL> commit;
Commit complete
SQL> select '*' ||
2 extractvalue(xmltype(xml_clob),'/Message/Entity/ASSIGNMENT/OAVendorLocation')
3 || '*' as result
4 from t_org;
RESULT
SQL> update t_org set xml_clob =
2 updatexml(xmltype(xml_clob),
3 '/Message/Entity/ASSIGNMENT/OAVendorLocation/text()','LONDON').getClobVal()
4 ;
1 row updated
SQL> select '*' ||
2 extractvalue(xmltype(xml_clob),'/Message/Entity/ASSIGNMENT/OAVendorLocation')
3 || '*' as result
4 from t_org;
RESULT
*LONDON*
Does the OAVendorLocation really have a whitespace value?
If not then it's expected behaviour, you're trying to update a text() node that doesn't exist. In this case, the solution is to use appendChildXML to create the text() node, or update the whole element.
Is it your real document? Do you actually have some namespaces? -
Creating a view with existing GeoRaster columns and new SDO_GEOMETRY column
Hi,
In a nutshell, I already have 1 real table, which has several attributes including types such as text, numbers etc. but also a GeoRaster column. This table works great, has its metadata stored properly and is spatially indexed; no worries.
I am then creating a view based on the above mentioned table, including the GeoRaster column. This worked, no problems. However now I want the same view to also have a SDO_GEOMETRY column which explicitly stores the spatial extent for each GeoRaster. Note the original table does not have this SDO_GEOMETRY column. So, I have created a revised SQL statement to create the view, but now it dynamically adds a new column and puts the GeoRaster.spatialextents into the SDO_GEOMETRY column.
This worked, the data made it into the view, but when we try to view the SDO_GEOMETRY in a viewer, we get errors. I added a system metadata entry for the view, but this did not help. Also, it is not possible to spatially index a view so I knew that was not the problem.
I think what has happened is the SDO_GEOMETRY column is in a sort of "limbo", where because it was not contained in the original table (and indexed there) and it is not able to be indexed in a view, it cannot be manipulated/viewed/used spatially.
Here is a snippet describing the original table:
"IMAGERY_ID" NUMBER NOT NULL ENABLE,
"CAM_ANGLE_X" NUMBER,
"CAM_ANGLE_Y" NUMBER,
"CAM_ANGLE_Z" NUMBER,
"SPEED" NUMBER,
"HEADING" NUMBER,
"IMAGE_GEOR" "SDO_GEORASTER",
"ACQUISITION_TIME" TIMESTAMP (6),
"SENSOR_ID" NUMBER,
"DOWNWARD_LOOKING" CHAR(1 BYTE),
"ORG_ID" NUMBER,
"POC_ID" NUMBER,
"FILE_NAME" VARCHAR2(100 BYTE),
"CORRELATION_ID" VARCHAR2(256 BYTE),
And here is the statement I used to create the new view:
CREATE VIEW level_0_img_view (imagery_id, cam_angle_x, cam_angle_y, cam_angle_z, speed, heading, image_geor, acquisition_time, sensor_id, downward_looking, org_id, poc_id, file_name, correlation_id, geor_extents)
AS
SELECT a.imagery_id, a.cam_angle_x, a.cam_angle_y, a.cam_angle_z, a.speed, a.heading, a.image_geor, a.acquisition_time, a.sensor_id, a.downward_looking, a.org_id, a.poc_id, a.file_name, a.correlation_id, a.image_geor.spatialextent
FROM imagery a
WHERE a.file_name LIKE '%.lev0';
Note in the above statement that the "geor_extents" column is the new column added dynamically (and not in the original table). Note the new column with the SDO_GEOMETRY data is flawless, I have looked at the records in SQL developer and all the data is there.
Any ideas?
In case you're wondering, I do have reasons for: (i) wanting an explicit column with the SDO_GEOMTRY (serving via WFS), and (ii) not wanting to alter the original table to include the equivalent SDO_GEOMETRY column.
Cheers,
M.Hi,
if you are having problems to display your view spatial columns in MapBuilder/MapViewer, you may be missing to register the view information in the metadata (name and spatial columns).
For example, lets see the following table that simulates your case:
SQL> desc pci_image;
Name Null? Type
GEORID NOT NULL NUMBER
TYPE VARCHAR2(32)
GEORASTER MDSYS.SDO_GEORASTER
-- create a view
create view pci_img_view (georid,georaster,geor_extents)
as
select a.georid,a.georaster,a.georaster.spatialextent
from pci_image a;
-- register metadata for view spatial columns (GeoRaster and geometry column)
insert into user_sdo_geom_metadata
select 'PCI_IMG_VIEW','GEORASTER.SPATIALEXTENT', diminfo, srid
from user_sdo_geom_metadata where table_name = 'PCI_IMAGE'
insert into user_sdo_geom_metadata
select 'PCI_IMG_VIEW','GEOR_EXTENTS', diminfo, srid
from user_sdo_geom_metadata where table_name = 'PCI_IMAGE'
There is no need to index the spatial columns if they have been indexed before.
Now, if you go in MapBuilder you should see the the view name in the list of geometry tables, and be able to create a theme on column GEOR_EXTENTS (select it on the combo box) and to preview it.
For the GeoRaster column, currently the view name is not shown on the list of GeoRaster tables in MapBuilder.
For GeoRaster data, MapBuilder uses the contents of metadata view user_sdo_geor_sysdata, and then it would be needed to register the view contents there. We will talk with Jeffrey to check if there is any problem in registering
view contents in this metadata view. If the view name and georaster column is registered in user_sdo_geor_sysdata,
then it should show in MapBuilder. But you can still create a GeoRaster theme for this view using a SQL command, and should be able to preview it in MapBuilder.
-- create a GeoRaster theme based on view Georaster column.
insert into user_sdo_themes values (
'PCI_IMAGE_V_GEOR',
'View of georaster column',
'PCI_IMG_VIEW',
'GEORASTER',
'<?xml version="1.0" standalone="yes"?>
<styling_rules theme_type="georaster" raster_id="1" raster_table="RDT_PCI" raster_bands="0,1,2">
</styling_rules>');
-- commit changes
commit;
Joao -
Updatable Materialized View with Union ALL
(please don't ask about db structure)
DB: 11gR2
create table table_1 (
id number primary key,
val varchar2(100)
create table table_2 (
id number primary key,
val varchar2(100)
insert into table_1(id) values (0);
insert into table_1(id) values (2);
insert into table_1(id) values (3);
insert into table_1(id) values (4);
insert into table_1(id) values (5);
insert into table_2(id) values (10);
insert into table_2(id) values (12);
insert into table_2(id) values (13);
insert into table_2(id) values (14);
insert into table_2(id) values (15);
update table_1 set val='Table1 val:'||id;
update table_2 set val='Table2 val:'||id;
create view v_table_all as
select * from table_1
view V_TABLE_ALL created.
select * from v_table_all;
ID VAL
0 Table1 val:0
2 Table1 val:2
3 Table1 val:3
4 Table1 val:4
5 Table1 val:5
select column_name, updatable, insertable, deletable
from user_updatable_columns
where table_name = 'V_TABLE_ALL'
COLUMN_NAME UPDATABLE INSERTABLE DELETABLE
ID YES YES YES
VAL YES YES YES
update v_table_all set val='XXX changed' where id = 3;
1 row updated.
select * from table_1;
ID VAL
0 Table1 val:0
2 Table1 val:2
3 XXX changed
4 Table1 val:4
5 Table1 val:5
rollback;
select * from table_1;
ID VAL
0 Table1 val:0
2 Table1 val:2
3 Table1 val:3
4 Table1 val:4
5 Table1 val:5
create or replace view v_table_all as
select * from table_1
union select * from table_2;
view V_TABLE_ALL created.
select * from v_table_all;
ID VAL
0 Table1 val:0
2 Table1 val:2
3 Table1 val:3
4 Table1 val:4
5 Table1 val:5
10 Table2 val:10
12 Table2 val:12
13 Table2 val:13
14 Table2 val:14
15 Table2 val:15
select column_name, updatable, insertable, deletable
from user_updatable_columns
where table_name = 'V_TABLE_ALL'
COLUMN_NAME UPDATABLE INSERTABLE DELETABLE
ID NO NO NO
VAL NO NO NO
trying update:
update v_table_all set val='XXX changed' where id = 3;
SQL-Fehler: ORA-01732: Datenmanipulationsoperation auf dieser View nicht zulässig
01732. 00000 - "data manipulation operation not legal on this view"
*Cause:
*Action:
drop view v_table_all;
view V_TABLE_ALL dropped.all is ok before this point.
now we want create a new materialized view with some query
create materialized view v_table_all
as
select * from table_1
union all select * from table_2 ;
materialized view V_TABLE_ALL created.
select column_name, updatable, insertable, deletable
from user_updatable_columns
where table_name = 'V_TABLE_ALL'
COLUMN_NAME UPDATABLE INSERTABLE DELETABLE
ID YES YES YES
VAL YES YES YES it seems to be ok with update.
but...
update v_table_all set val='XXX changed' where id = 3;
SQL-Fehler: ORA-01732: Datenmanipulationsoperation auf dieser View nicht zulässig
01732. 00000 - "data manipulation operation not legal on this view"
*Cause:
*Action:How can solve this issue??
Any suggestionLooks like user_updatable_columns sort of thinks the MV is just a table - I don't know about that...
An MV on a single table can be updated - I tried that and it works:
create materialized view mv_table_1 for update
as
select * from table_1;I noticed [url http://download.oracle.com/docs/cd/E11882_01/server.112/e16579/advmv.htm#sthref294]examples stating the UNION ALL needs a "marker" so Oracle can know from the data which source table a row in the MV originates from - like this:
create materialized view v_table_all for update
as
select 'T1' tab_id, table_1.* from table_1
union all
select 'T2' tab_id, table_2.* from table_2 ;But that also fails (the "marker" requirement was specifically for FAST REFRESH, so it was just a long shot ;-) )
What are you planning to do?
<li>Create the MV.
<li>Update records in the MV - which then is no longer consistent with the source data.
<li>Schedule a complete refresh once in a while - thereby overwriting/losing the updates in the MV.
If that is the case, I suggest using a true table rather than an MV.
<li>Create table t_table_all as select ... .
<li>Update records in the table - which then is no longer consistent with the source data.
<li>Schedule a job to delete table and insert into table select ... once in a while - thereby overwriting/losing the updates in the table.
In other words a kind of "do it yourself MV".
I cannot see another way at the moment? But perhaps try in the data warehousing forum - the people there may have greater experience with MV's ;-) -
Slow delete on a table with one CLOB column
Hi,
I have a table which has one CLOB column and even if I delete one row from it, it takes approx. 16 seconds. Since UNDO isn't generated for CLOBs (at least not in the UNDO tablespace), I can't figure out why this is so? The CLOB has defined a RETENTION clause, so it depends upon UNDO_RETENTION which is set to 900. There wasn't any lock from another session present on this table.
The table currently contains only 6 rows but it used to be bigger in the past, so I thought that maybe a full table scan is going on when deleting. But even if I limit the DELETE statement with an ROWID (to avoid a FTS), it doesn't help:
SQL> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
PL/SQL Release 11.1.0.6.0 - Production
CORE 11.1.0.6.0 Production
TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
NLSRTL Version 11.1.0.6.0 - Production
SQL> select count(*) from scott.packet;
COUNT(*)
6
SQL> column segment_name format a30
SQL> select segment_name
2 from dba_lobs
3 where owner = 'SCOTT'
4 and table_name = 'PACKET';
SEGMENT_NAME
SYS_LOB0000081487C00002$$
SQL> select segment_name, bytes/1024/1024 MB
2 from dba_segments
3 where owner = 'SCOTT'
4 and segment_name in ('PACKET', 'SYS_LOB0000081487C00002$$');
SEGMENT_NAME MB
PACKET ,4375
SYS_LOB0000081487C00002$$ 576
SQL> -- packet_xml is the CLOB column
SQL> select sum(dbms_lob.getlength (packet_xml))/1024/1024 MB from scott.packet;
MB
19,8279037
SQL> column rowid new_value rid
SQL> select rowid from scott.packet where rownum=1;
ROWID
AAAT5PAAEAAEEDHAAN
SQL> set timing on
SQL> delete from scott.packet where rowid = '&rid';
old 1: delete from scott.packet where rowid = '&rid'
new 1: delete from scott.packet where rowid = 'AAAT5PAAEAAEEDHAAN'
1 row deleted.
Elapsed: 00:00:15.64From another session I monitored v$session.event for the session performing the DELETE and the reported wait event was 'db file scattered read'.
Someone asked Jonathan Lewis a similar looking question (under comment #5) here: http://jonathanlewis.wordpress.com/2007/05/11/lob-sizing/ but unfortunately I couldn't find if he wrote any answer/note about that.
So if anyone has any suggestion, I'll appreciate it very much.
Regards,
JureAfter reviewing the tkprof as suggested by user503699, I noticed that the DELETE itself is instantaneous. The problem is another statement:
select /*+ all_rows */ count(1)
from
"SCOTT"."MESSAGES" where "PACKET_ID" = :1
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 2 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 1 1.40 16.93 125012 125128 0 1
total 3 1.40 16.93 125012 125128 2 1
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: SYS (recursive depth: 1)
Rows Row Source Operation
1 SORT AGGREGATE (cr=125128 pr=125012 pw=125012 time=0 us)
0 TABLE ACCESS FULL MESSAGES (cr=125128 pr=125012 pw=125012 time=0 us cost=32900 size=23056 card=5764)I checked if there was any "ON DELETE" trigger and since there wasn't, I suspected this might be a problem of unindexed foreign keys. As soon as I created an index on SCOTT.MESSAGES.PACKET_ID the DELETE executed immediately. The "funny" thing is that, the table SCOTT.MESSAGES is empty, but it has allocated 984MB of extents (since it wasn't truncated), so a time consuming full tablescan was occurring on it.
Thanks for pointing me to the 10046 trace which solved the problem.
Regards,
Jure -
Error when trying to use (GUI Wizards) on Table with BLOB, CLOB columns.
I enjoyed watching the demo of ODP.NET/VS 2005 Environment where you can just drag the new command builders, data sets, etc.. but when I try this with a table that contains a BLOB and CLOB column it returns an error and basically cannot build the SQL needed to process these field types.
I would assume it could do this natively since it is somewhat of a primitive type. I also tried to point it to a Stored Proc that returned a blob and it caused an error when building the SQL.
So it appears it is not possible to use the GUI data access wizards for these column types. I can use them in code with the ODP.NET with no problems but it would be nice to be able to utilize the GUI Command Builders, etc...blob and clob are not supported i guess. oracle is a bit sluggish when it comes to VS and MS products!
-
Workaround for ORA-02060: update on view with db-link
Hello,
In my application I have a page that is based on a view. This view itself is based on a table in the same database and a table in another database which I pick up through a db-link.
To update the data in the view I have created an instead-of trigger which handles all the DML (which is a direct update on the local table and a message towards a broker for the update of the remote database).
When updating from the database with a statement like UPDATE VIEW SET COLUMN1 = VALUE WHERE COLUMN2 = PK_ID, there is no problem. Everything is triggered in the right way.
But when I want to update a row in my APEX page I get 'ORA-02060: select for update specified a join of distributed tables'. This is due to the fact that APEX fetches the row as SELECT * FROM VIEW FOR UPDATE.
How can I work around this? I don't need the locking mechanism that 'FOR UPDATE' provides, because I can solve that myself. So basically, can I alter APEX's statement that performs the Automatic Row Processing (DML)?So you answered your question yourself :) Pretty or not, it does the work. Imagine programmers beeing able to work only using wizards and have no clue about what they do. What kind of quality would you get? :)
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://apex.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------- -
How to view the entire CLOB in results table?
According to the release notes with 1.2.1.32, a recent bug fix changed the way CLOBs are displayed in SQL Developer:
Bug 6254736: Clob datatype in table grid fetches the whole clob
Before the fix, for any given CLOB field, the entire CLOB data would be displayed. After the fix, only "(CLOB)" and a few characters are displayed. The entire data is only accessible via the Edit Value dialog.
I understand this change will likely improve performance for very large CLOBs. However, there are times when I want to be able to view the entire CLOB in the table grid (either in the data tab or as the result of a SQL query). Is there any way to restore the old functionality? If not, is there any plan to add a new preference to support the old functionality? Thanks for your help!The same issue was pointed a while back here : Re: RAW displayed in columns
We would have a solution for it, most likely as a preference.
-Raghu -
Obiee 11g Administrator: Dividing an INT with an INT column results in INT
OBIEE 11.1.1.7.1
I have developed a formula column in BMM. The column is based on dividing an INT column with another INT column.
The formula column picks automatically the type as INT and when I developed a report on this column it shows integer values instead of decimal.
Dividing Profit by Cost (both integers) should give an index which is a decimal value. How to come up with that?Multiply with 1.0 to see decimal values
ex: (a*1.0)/b
or else try data format in report
if helps mark -
Materialized view with a dynamic column.
Hi,
Is it possible to use the materialized view as a function.
A column of the view is dynamic, meaning we enter a parameter in the view.
thanksOnce I called exp/imp from forms. That didn't make export errors due to data corruption a forms problem...
cheers -
Confirm an account and then update a view with the results of customer hist
Hello Everyone,
I have a question and was wondering if someone can help.
In IC Webclient, in a B2B scenario, I change the framework so that when it tries to call BuPaIbaseSearch view, calls instead IRecHistory.
My intention is that when we need to identify an account, we show the views BuPaSearchB2B and the IRecHistory, side-by-side. OK.
When we confirm an acount, I need to display the last five interaction records in the IRecHistory view.
The problem is that when I confirm an acount (at BuPaSearchB2B), this view (IRecHistory) changes his buttons layout, but doesn't fill the table with the data. When if I go to somewhere else, no matter what entry in my navigation bar, and then return, the table is now filled.
How can I fill this table, right after the confirmation of an account? Maybe a refresh of the IRecHistory view?? How can I manage that?
Can somebody give me hints?
Best regards
Bruno GarciaI am not sure to understand what you are explaining. As far as I understand you have two frames and when you change somehing in one and you go to the other passing a table the last one does not get the values but when you return you have the table fill.
Well, I am also working with frames and I have had the same problems with the attributes. Sometimes it was because they were "Auto", and other it was because the page was stateless instead of statefull. I am not sure enough as to explain you what is the rigth combination so I suggest you to try.
Good luck.
-- Oscar -- -
ADF BC: Creating updatable VO based upon DB View with "instead of" trigger
Hello all,
I have got an interesting issue. I have an Oracle DB view that is used to hide some complexity in the underlying DB design (it does some unions). This view is updatable because we have created an "instead of" update trigger to update the correct table when a row is updated. This is working fine in SQL.
Next, we have created an ADF Entity object based upon the view, specifying an appropriate PK for the DB View. Then, we have created an updatable VO based upon the EO. All well and good so far. The issue we have is in trying to commit changes to the DB - because the ADF BC framework is trying to lock the row to update (using SELECT ... FOR UPDATE), it's not working because of ORA-02014 - cannot select FOR UPDATE from view with DISTINCT, GROUP BY, etc.
This leads me to thinking about overridding doSelect() on the EO as hinted here http://radio.weblogs.com/0118231/stories/2005/07/28/differenceBetweenViewObjectSelectAndEntityDoselectMethod.html
As a temporary test, we have over-ridden the EO's doSelect to call super.doSelect(false) and it does work, although we will have lost update issues as detailed in Steve's article.
My questions:
1). Is overriding doSelect() the correct thing here? Perhaps there is a better way of handling this problem? I do have a base EO class from which all of the EO's extend, so adding this behavior should be straightforward.
2). Does anyone have example doSelect implementation? I am thinking of overriding doSelect for my EO and calling super.doSelect (lock=false), but then I need to deal with some possible exceptions, no?
Kind regards,
JohnHi John,
I have exactly the same issue as you experienced back in January. I have a complex data modelling requirement which requires the need to pivot rows into columns using ROW_NUMBER() and PARTITION clauses. To hide the complexity from the middle tier, I have created a database view and appropriate INSTEAD OF triggers and mapped my EO to the view. I have overriden the lock() method on the EO implementation class (to avoid ORA-02014) and would like to try the same solution you used with the pl/sql call to lock the record.
My question is, how did you manage the release of the lock if the transaction was not rolled back or committed by your application i.e. if the user closed the browser for instance.
In my naivity, I would like to think that the BC4J framework would release any locks for the database session when it found the servlet session to be terminated however my concern is that the lock would persist and cause complications.
Any assistance greatly appreciated (if you would be willing to supply your lock() method and pl/sql procedure logic I would be even more grateful!).
Many thanks,
Dave
London -
ApEx 4.1.1: update record in a view with 'instead of update' trigger
I created a form against a view. The view is complex enough which prevents direct updates. To incorporate the update logic I created an 'instead of update' trigger on the view. When I open up the form, do changes, and click 'Apply Changes' button I am getting the following exception
ORA-02014: cannot select FOR UPDATE from view with DISTINCT, GROUP BY, etc.
I understand that the standard 'Automatic Row Processing' process is trying to lock the record before updating using a cursor like
select *
from my_view
for update
and fails. Is it possible to bypass this locking while using the standard APEX processes?
I think I can create a custom PL/SQL process which would execute the UPDATE statement (at least, it works in SQL*Plus), but I would like to know if I can use a standard ApEx functionality for this.Hello,
Sorry for delay.
I had found a feedback about trigger issue when restore SQL Database from a BACPAC file. Microsoft said the fixed will be available in the next major release of DacFx.
Feedback:
SQL Azure fires a trigger when restoring from bacpac
You can refer to the workarounds in the feedback. For example, if there is small amount of triggers on the database, you can try to remove the triggers and then recreate when restore from bacpac file.
Regards,
Fanny Liu
Fanny Liu
TechNet Community Support
Maybe you are looking for
-
How is upgrading to a higher package mid month handled. Lets say im on a $29 package and half way through the month i decide to upgrade, do i start the new monthly subscription from that date and essentially forfeit the other half of my subscription.
-
How to get out of recovery mode in ipod touch 4thgen?
Hello Apple i am rohith. iam having ipod touch 4th gen. it has ios version 4.1. recently i tried to update it, i have downloaded the update also but while installing an errour has occured and it has gone to recovery mode. can u please give your answe
-
Safari 5.0.5 freezes on wake
If I close my MBP, with Safari open, it freezes when I open it back up. All other programs work, but slower. Took it to the Genius (sic) bar and they told me to install Clicktoflash to block flash. Still froze. I've reset Safari and deleted the pre
-
Hi experts, I would like to know the total number of operations (DDL and DDL) performed on a table in oracle dabatase since it was created. Please advice.
-
I am building a multi language dvd in Encore for the first time as it seems like it could be quicker than the more complex programmes used previously but I have some questions about the navigation. To conserve space, I have only created one series of