This is a discussion on QMF for Windows and Updateable Views within the DB2 forums, part of the Database Server Software category; --> I created an updateable view, which joins two tables, in a DB2 UDB database. The view was made updateable ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I created an updateable view, which joins two tables, in a DB2 UDB database. The view was made updateable by the creation of an "instead of" trigger. I'd like to use this view for updates via QMF for Windows or DB2 Table Editor. However, when I try to update from either of these tools, I receive an SQL0150 error. Is there anything I can do to allow the updates, such as update the READONLY value for the view in the catalog table? Thanks. |
| |||
| JC wrote: > I created an updateable view, which joins two tables, in a DB2 UDB > database. The view was made updateable by the creation of an "instead > of" trigger. I'd like to use this view for updates via QMF for Windows > or DB2 Table Editor. However, when I try to update from either of > these tools, I receive an SQL0150 error. The SQL0150 is an error code returned by DB2. This should be unrelated to the client you are using, i.e. QMF in your case. I would suspect that your instead of trigger does not work or that you do not have one. Could you possibly post the DDL statements for the tables, views and the triggers along with the update or insert statements that raise the error in question? > Is there anything I can do to > allow the updates, such as update the READONLY value for the view in > the catalog table? Thanks. You cannot update the db2 catalog tables (views). And that's for good reasons. -- Knut Stolze DB2 Information Integration Development IBM Germany |
| |||
| I forgot to mention above that I successfully tested the update via the view from the DB2 CLP and the DB2 Command Center. I've also been able to update from QMF for a view over a single table. The error only occurs for the view over the two tables, when the update is attempted in QMF. |
| |||
| JC wrote: > I forgot to mention above that I successfully tested the update via the > view from the DB2 CLP and the DB2 Command Center. I've also been able > to update from QMF for a view over a single table. The error only > occurs for the view over the two tables, when the update is attempted > in QMF. > DB2 determines the updatability of a view soley by its' structure. E.g. a view based on a JOIN is not updatable. The rules are describe )I think) in teh CREATE VIEW statement. Search for "updatable view" If you need to update such a "complex" views you can take a look at INSTEAD OF TRIGGERs. Such a trigger defines a mapping from the view to the base table (typically the reverse operation from the SELECT). Cheers Serge -- Serge Rielau DB2 Solutions Development IBM Toronto Lab |
| |||
| JC wrote: > Any idea why QMF for Windows and DB2 Table Editor both receive the > SQL0150 error on update via the view, but CLP does not? > Do these tools have an option to dump the SQLCA? Would be interesting to see where the message originated (server or client). Cheers Serge -- Serge Rielau DB2 Solutions Development IBM Toronto Lab |
| |||
| Serge Rielau wrote: > JC wrote: >> Any idea why QMF for Windows and DB2 Table Editor both receive the >> SQL0150 error on update via the view, but CLP does not? >> > Do these tools have an option to dump the SQLCA? > Would be interesting to see where the message originated (server or > client). Maybe QMF uses CLI (I strongly suspect it but don't know for sure). This could also be used to verify that the exact same query as on the command line triggers the error message. -- Knut Stolze DB2 Information Integration Development IBM Germany |
| |||
| Knut Stolze wrote: > Maybe QMF uses CLI (I strongly suspect it but don't know for sure). This > could also be used to verify that the exact same query as on the command > line triggers the error message. ....by collecting a CLI trace. -- Knut Stolze DB2 Information Integration Development IBM Germany |
| ||||
| JC wrote: > I took a CLI trace, but don't see any thing in the file. You should see the SQL0150 somewhere (assuming that QMF uses only CLI and nothing else besides it). If not, then the error seems to originate from another places. -- Knut Stolze DB2 Information Integration Development IBM Germany |
| Thread Tools | |
| Display Modes | |
|
|