ralf schneider wrote :

>Hi,

>I want to create a view with the following SQL statement:

>CREATE VIEW k_0001_combobox_texts AS
>SELECT A."tid", A."language", A."text", A."abbrev"
>FROM combobox_texts A, combobox B
>WHERE A."tid" = B."tid" AND B."cip" = 3
>WITH CHECK OPTION

>The two tables combobox_texts and combobox are defined as follows:

>CREATE TABLE combobox
>(
>  "type"                VARCHAR(16),
>  "tid"                 SMALLINT,
>  "order"               SMALLINT,
>  "delete_it"           BOOLEAN DEFAULT FALSE,
>  "cip"                 INTEGER,
>  PRIMARY KEY ("tid", "cip")
>)

>CREATE TABLE combobox_texts
>(
>  "tid"                 SMALLINT,
>  "language"            VARCHAR(16),
>  "text"                VARCHAR(64),
>  "abbrev"              VARCHAR(3),
>  PRIMARY KEY ("tid", "language")
>)

>When I execute the CREATE VIEW statement I get the error message:

>[SAP DB]General error;-7051 POS(1) Read only view WITH CHECK OPTION not 
>allowed.

>But why? What do I have to do for being able to create an editable view?

Your view is a join view. Join views can only be updatable, 
if you have 1 : n releationships between the tables involved. 
These 1 : n relationsships have to be defined as foreign keys.
None of your table contains a foreign key definition, therefore the view is read only.
It's not clear for me, which columns of what table should form your foreign key.
For further information please see

http://www.sapdb.org/htmhelp/e0/ed9036dfe4b903e10000009b38f889/frameset.htm

Thomas  
-- 
Thomas Anhaus
SAP DB, SAP Labs Berlin
[EMAIL PROTECTED]
http://www.sapdb.org/
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general


_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to