Peb puas tuaj yeem siv DDL hauv cov txheej txheem khaws cia?
Peb puas tuaj yeem siv DDL hauv cov txheej txheem khaws cia?

Video: Peb puas tuaj yeem siv DDL hauv cov txheej txheem khaws cia?

Video: Peb puas tuaj yeem siv DDL hauv cov txheej txheem khaws cia?
Video: Siv Yis Neeb Leej Cawm Seej Music Video Short 2024, Hlis ntuj nqeg
Anonim

Koj siv tau nkaus xwb DDL COMMENT nqe lus hauv a khaws cov txheej txheem . Koj tsis tuaj yeem hais qhia DML COMMENT nqe lus, uas txwv tsis pub siv SQL embedded, mus nqa cov lus rau cov khoom siv database, txhua kab ntawm lub rooj, thiab cov kev txwv.

Ib yam li ntawd, tib neeg nug, peb puas tuaj yeem siv DDL hauv cov txheej txheem?

DDL cov lus tsis pub nyob rau hauv Cov txheej txheem (PLSQL BLOCK) PL/SQL khoom yog precompiled. Ntawm qhov tod tes, DDL (Data Definition Language) cov lus zoo li CREATE, DROP, ALTER commands thiab DCL (Data Control Language) cov lus zoo li GRANT, REVOKE ua tau hloov cov dependencies thaum lub sij hawm ua tiav ntawm qhov kev pab cuam.

Tsis tas li, peb puas tuaj yeem sau DDL nqe lus hauv kev ua haujlwm hauv Oracle? Tsis muaj DDL tso cai: A muaj nuj nqi hu los ntawm sab hauv a SQL lus yog txwv tsis pub DDL vim DDL teeb meem ib tug implicit cog lus. Koj tsis tuaj yeem tawm ib qho twg DDL cov ntsiab lus los hauv ib PL/SQL muaj nuj nqi . Kev txwv tsis pub muaj kev txwv: Koj siv tsis tau a muaj nuj nqi nyob rau hauv lub check constraint ntawm tsim lub rooj DDL lus.

Tsis tas li ntawd, DDL tuaj yeem siv hauv PL SQL?

2 Teb. Raws li nws hais nyob rau hauv cov ntaub ntawv: Tsuas yog dynamic SQL tau ua raws li cov lus qhia hauv qab no PL / SQL ntawv program units: Data definition lus ( DDL ) cov nqe lus xws li CREATE, DROP, GRANT, thiab REVOKE.

Peb puas tuaj yeem tsim cov lus hauv cov txheej txheem khaws cia?

Hauv a khaws cov txheej txheem koj tuaj yeem tsim a rooj los yog saib. Cov rooj tau ua ib ntus, hauv - nco rooj (saib CREATE TABLE ). Txawm li cas los xij, koj tsis tuaj yeem xa mus rau qhov ntawd rooj los yog saib hauv tib yam khaws cov txheej txheem . Cov Tsim txheej txheem / ALTER txheej txheem nqe lus sau tag nrho SQL SELECT thiab DML nqe lus.

Pom zoo: