Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Error inserting values in ORDBMS table

Author  Topic 

lazyme
Starting Member

8 Posts

Posted - 2009-10-08 : 10:06:14
Hi,

I am creating a table of chats. The chat can be either a private chat or a public chat and so I have created a chat_type object and created types private_chat_type and public_chat_type under chat type as below

CREATE TYPE chat_type AS OBJECT
(
chat_id VARCHAR(20),
content VARCHAR(100),
user_id VARCHAR(20),
ditto NUMBER,
ditto_user_id VARCHAR(20),
datechat DATE,
time_zone VARCHAR(20),
tags VARCHAR(100)
) NOT FINAL;
/

CREATE TYPE private_chat_type UNDER chat_type
(
receiver_user_id VARCHAR(20),
parent_chat_id VARCHAR(20),
reply_flag VARCHAR(10)
);
/

CREATE TYPE public_chat_type UNDER chat_type
(
);
/

create TABLE chat_table OF chat_type
(
PRIMARY KEY(chat_id)
);


Now, when I insert values in the chat_table I get an error saying

ERROR at line 1:
ORA-02315: incorrect number of arguments for default constructor


The syntax I have used to insert values are as below.

INSERT INTO chat_table VALUES( public_chat_type( NULL, NULL, NULL), chat_type( 'p1', 'I lost', 'u26', 1, 'u26',  to_date('9/30/2009 5:00','MM/DD/YYYY mi:ss'), -5, 'hello' ) );

INSERT INTO chat_table VALUES( private_chat_type( u2, NULL, F), chat_type( 'p1', 'Hi there', 'u21', 1, 'u36', to_date('9/30/2009 5:00','MM/DD/YYYY mi:ss'), -5, 'welcome' ) );


Could you please help me figure out the problem in my SQL statements.

Thanks.

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-10-08 : 10:26:49
This site is for MS SQL Server
Post your question at Oracle Forums such as www.orafaq.com

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

lazyme
Starting Member

8 Posts

Posted - 2009-10-08 : 10:44:40
Ok thanks.
Go to Top of Page
   

- Advertisement -