How to resolve error ORA-20987: APEX - ORA-02015? - oracle

I have a page in apex with multiple interactive grid. In one of the interactive grid i am trying to update the data of a column of a table in the database. The column named defect kind is a dropdown in the grid and on click of save should be able to updated the column value in database with the selected value in the grid.
While clicking on save apex is showing an error as follows:
Ajax call returned server error ORA-20987: APEX - ORA-02015: cannot select FOR UPDATE from remote table for.
I have used the type interactive grid - automatic row processing(DML) for saving the grid. Only defect kind is selected by the user rest all column value are coming directly from the table.
Interactive grid image:
NOTE:For this workspace the tables are accessed through a database link. I am using APEX 5.1.

This error is raised specifically because you are working over a database link.
Error code: ORA-02015
Description: cannot select FOR UPDATE from remote table
Cause: An attempt was made to select FOR UPDATE on a remote table (directly, or via a view) that had abstract data type columns, and the
view or select list contained abstract data type columns or non-column
items.
Action: To attempt a select FOR UPDATE, use a view or select list that consists only of base columns from the remote table, none of
which may be abstract data type columns.
I can't tell from what you've posted if the issue is with the query you're using to populate the IG or with some underlying view or the table itself. Depending your ability to locate and remove the "abstract data type columns or non-column items" (if that's even possible with an IG) you may not be able to make this work with automatic row processing over a database link at all. It may require a custom PL/SQL API instead.

Have you tried to set the attribute Lock Row (group Settings) to No in your Interactive Grid - automatic row processing(DML) process?

Related

ORA-01436: CONNECT BY loop in user data in Toad Used by Tab for tables

As you know in TOAD, we can see where a table is used (in package or in view).
But when i try to see where my table is used it is showing the error :ORA-01436: CONNECT BY loop in user data.
Other tables are showing up their used status nicely.
Any help??enter image description here
Alternatively you can use ALL_SOURCE to check where your table has been referred in the code.

Oracle APEX automatic column add/remove in region

I have made a view that changes it's columns frequently with dynamic SQL. I use a pivot to make rows into columns. I display the view in an interactive grid. The SQL query that is executed:
select * from <DB>.<VIEWNAME>.
On refresh it updates the ROWS in the grid, but not the COLUMNS. The select * does not take column changes into account, BUT if I alter the SQL query by adding a space ( or any other thing in the query) and then saving the page in the page designer, the columns sync up to the view.
Does someone know a good solution to my problem? Where can I find the procedure that executes this refresh? If I know where it is I can possiby use it after the insertion of a column (or delete / update). Any tips? Warning, I am a total novice in oracle apex and sql developer.
Thanks in advance!
This is the wrong way to go about this. In Apex, and in Oracle in general, columns are determined when the query is parsed. If you change the underlying structure, your query has to be reparsed and only then do the columns change.
Think about it. If the first column in your result set was a DATE and you had your Apex column attributes set up to format and display that data, then your query changed to a NUMBER, its not clear what would happen.
What you probably want to do is create your region based on a function that returns a sql query as a VARCHAR2. (I think you can do this in 18.x; I'm still mostly using 5.2.) Your function gets parsed when the region is displayed. You can even use another function to return a colon-separated list of column headers if the names are dynamic.

Oracle APEX DML form (with no report) doesn't show existing data in the table

I've been able to create APEX forms with reports and interactive grids successfully, but when I tried to just create a simple DML form, using the wizard, I get a page where I can create a row, but I can't see the existing data in the table.
This particular table always has only one row and I just need a form to update that 1 row. How can I get this view to open in update mode?
If you don't know ahead of time what any of the values in one of the columns, you can use ROWID as the primary key and set it to the row's ROWID in order to trigger the automatic row fetch process.
Create a hidden item called P1_ROWID. Its Source should be set to Database Column, ROWID.
On the Automatic Row Fetch process, set Primary Key Column to ROWID and Primary Key Item to P1_ROWID.
Create an additional process, to run before the automatic row fetch process, that executes a query like the following:
select rowid into :P1_ROWID from mytable;

Create a sequence not related to any primary key in Oracle SQL Developer Data Modeler

I need to create a sequence whose value is going to be read by call to .NEXTVAL in PL/SQL code and saved in more then one record of a specific table column, so my design doesn't require to define a PK on the aforementioned column.
I cannot find out how to edit the sequence tab in Oracle Data Modeler (I'm on version 4.1.1) when the PK checkbox is not selected (all the sequence related fields are disabled).
Any idea?
In the relational model, choose your DB and within that you will find sequence as an item to create. You can also create other types of object here.

How to create refresh statements for TableAdapter objects in Visual Studio?

I am working on developing an ADO.NET data provider and an associated DDEX provider. I am unable to convince the Visual Studio TableAdapater Configuration Wizard to generate SQL statements to refresh the data table after inserts and updates. It generates the insert and delete statements but will not produce the select statements to do the refresh.
The functionality referred to can be accessed by dropping a table from the Server Explorer (inside Visual Studio) onto a DataSet (e.g., DataSet1.xsd). It creates a TableAdapter object and configures SELECT, UPDATE, DELETE, and INSERT statements. If you right click on the TableAdapter object, the context menu has a “Configure” option that starts the “TableAdapter Configuration Wizard”. The first dialog of that wizard has an Advanced Options button, which leads to an option titled “Refresh the data table”. When used with SQL Server tables, that option causes a statement of the form “select field1, field2, …” to be added on to the end of the commands for the TableAdapter’s InsertCommand and UpdateCommand.
Do you have any idea what type property or interface might need to be exposed from the DDEX provider (or maybe the ADO.NET data provider) in order to make Visual Studio add those refresh statements to the update/insert commands?
The MSDN documentation for the Advanced SQL Generation Options Dialog Box has a note stating, “Refreshing the data table is only supported on databases that support batching of SQL statements.” This seems to imply that a .NET data provider might need to expose some property indicating such behavior is supported. But I cannot find it. Any ideas?
The refresh functionality in TableAdapter means that the associated datatable for the tableadapter operation will have updated data after the operation is completed.
If you call insert method of the tableadapter and pass the datarow or the datatable for the insert operation, the tableadapter will refresh the datatable/datarow to reflect the latest values from the database after the insert operation. If your table in database has generate a unique-id or auto-number for the insert command for the given row to insert, the original datarow's p.key coloumn will reflect the auto-generate id value from the database. This refreshing will be taken care by the tableadapter provided you have set the refresh option to true in the wizard configuration.
Now to this 'refresh' tableadapter will execute 2 queries in single batch, first will be the Insert, then the select with the scope_identity.
EDIT
My default Insert command would fire this single SQL if Refresh is turned OFF on the TableAdapter
INSERT INTO Table (coloumns) VALUES (values);
But My default Insert command would fire these SQL statement batch if Refresh is turned ON on the TableAdapter. Datarow that is passed as argument to Insert() will also be updated after successful execution.
INSERT INTO Table (coloumns) VALUES (values);
SELECT coloumns FROM Table WHERE (PKeyID = SCOPE_IDENTITY())

Resources