If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > IS there any MySQL Default tables like DUAL in ORACLE.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-20-09, 03:58
amitbora27 amitbora27 is offline
Registered User
 
Join Date: May 2009
Posts: 41
IS there any MySQL Default tables like DUAL in ORACLE.

IS there any default table mysql server automatically creates and manages these tables like INSERTED, DELETED table in MSSQL, DUAL table in ORACLE.

I have used in mssql a query in trigger for insert operation
declare trg_cursor cursor for select fname from inserted;

In oracle a query in trigger for insert operation
select system.clsyncseq.nextval into synchpointnumber from dual;

like this i need default tables for mysql to fire a same query.

I have written a trigger on table t1 for insert. When inserted a row to t1 my trigger will read the information from INSERTED, DUAL tables in case of MSSQL, ORACLE instead of table t1.
The same thing I need to write for MySQL for INSERT, UPDATE, DELETE operation.
Can you please direct me to achieve this?
Thanks
Reply With Quote
  #2 (permalink)  
Old 05-20-09, 07:20
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
use exactly the same methods when writing mysql triggers

post back again when you receive any actual error message
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 05-20-09, 07:40
amitbora27 amitbora27 is offline
Registered User
 
Join Date: May 2009
Posts: 41
created table account :
+----------+---------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+---------------+------+-----+---------+-------+
| acct_num | int(11) | YES | | NULL | |
| amount | decimal(10,2) | YES | | NULL | |
+----------+---------------+------+-----+---------+-------+

If I use (MSSQL type)
declare trg_cursor cursor for select acct_num from inserted;

while insert :
mysql> INSERT INTO account (acct_num, amount) VALUES (0, 23);$
ERROR 1146 (42S02): Table 'amit.INSERTED' doesn't exist

When I use DUAL table (ORACLE) in trigger it gives error like:
mysql> INSERT INTO account (acct_num, amount) VALUES (0, 23);$
ERROR 1054 (42S22): Unknown column 'acct_num' in 'field list'
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On