sql >> データベース >  >> RDS >> Oracle

PostgresqlとOracle:共通のサブクエリから複数のテーブルを更新する

    次のようなもの:

    with recursive menu_tree (id, parent_id) as (
       select id, parent_id
       from menu
       where id = 200
       union all 
       select c.id, c.parent_id
       from menu c
         join menu_tree p on p.id = c.parent_id
    )
    , deleted_menus (menu_id) as (
       update menu
          set softdel = true
       where id in (select id from menu_tree)
       returning menu.id
    ),
    deleted_pages (page_id) as (
       update page
          set softdel = true
       where menu_id in (select menu_id from deleted_menus)
       returning page.id
    ),
    deleted_articles (article_id) as (
       update article
         set softdel = true
       where page_id in (select page_id from deleted_pages)
    )
    update article_lang
       set softdel = true
    where id in (select article_id from deleted_articles);
    


    1. Grails2.0.1でのOracle10gCLOBの使用

    2. MariaDBで特定の文字のASCIIコードを返す2つの方法

    3. Mac OS XへのROracleのインストール-Oracleには何が必要ですか?

    4. Herokuエラー:ActionView ::Template ::Error(#<Message:0x007fc9df016930>の未定義のメソッド `captcha')