Results 1 to 3 of 3
  1. #1
    Join Date
    May 2009
    Posts
    41

    Unanswered: 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

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    use exactly the same methods when writing mysql triggers

    post back again when you receive any actual error message
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    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'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •