Peb puas tuaj yeem siv ua tiav tam sim rau cov lus xaiv?
Peb puas tuaj yeem siv ua tiav tam sim rau cov lus xaiv?

Video: Peb puas tuaj yeem siv ua tiav tam sim rau cov lus xaiv?

Video: Peb puas tuaj yeem siv ua tiav tam sim rau cov lus xaiv?
Video: Peb Puas Nkag Tau Rau Ntuj Ceeb Tsheej Lub Nceeg Vaj los ntawm Kev Zam Txim rau Tej Kev Txhaum? 2024, Hlis ntuj nqeg
Anonim

Qhov kev pab cuam tuaj yeem siv EXECUTE IMMEDIATE . EXECUTE IMMEDIATE txhais a xaiv voj mus ua cov kab rov qab. Yog tias xaiv rov qab tsuas yog ib kab, nws tsis tsim nyog siv a xaiv voj.

Li ntawd, Yuav Siv tam sim ua li cas?

Koj tuaj yeem tso ib qho EXECUTE IMMEDIATE nqe lus nrog RETURNING BULK COLLECT INTO hauv ib daim ntawv FORALL. Koj tuaj yeem khaws cov txiaj ntsig ntawm txhua qhov INSERT, Hloov Kho, lossis DELETE cov lus hauv ib pawg ntawm cov khoom sau. Koj tuaj yeem hla subscripted sau cov ntsiab lus mus rau EXECUTE IMMEDIATE nqe lus los ntawm SIV lus.

Tom qab ntawd, lo lus nug yog, peb puas xav tau kev cog lus tom qab ua tiav tam sim? cog lus tsis tas yuav tom qab txhua EXECUTE IMMEDIATE . Tej lus hais ua TSIS TAU xav tau a cog lus ; piv, if koj truncate lub rooj nrog TRUNCATE. Tag nrho cov haujlwm uas tsis tau ua tiav hauv qhov kev hloov pauv tam sim no tau cog lus los yog dov rov qab - tsis yog nqe lus xwb raug tua los ntawm EXECUTE IMMEDIATE.

Hauv qhov no, peb puas tuaj yeem siv ua tiav tam sim hauv Oracle muaj nuj nqi?

Cov EXECUTE IMMEDIATE nqe lus executes dynamic SQL nqe lus los yog tsis qhia npe PL / SQL thaiv. Koj siv tau nws tawm SQL nqe lus uas tsis tuaj yeem sawv cev ncaj qha rau hauv PL / SQL , los yog tsim cov nqe lus nyob qhov twg koj ua tsis paub tag nrho cov npe lub rooj, qhov twg clauses, thiab lwm yam ua ntej.

Vim li cas peb thiaj li siv qhov kev txiav txim tam sim hauv Oracle?

EXECUTE IMMEDIATE pab kev ua tiav ntawm DML lossis DDL nqe lus uas yog tuav raws li txoj hlua thiab tsuas yog ntsuas ntawm lub sijhawm ua haujlwm. Qhov no ua rau ib tus tuaj yeem tsim cov lus hais raws li kev ua haujlwm logic. EXECUTE IMMEDIATE kuj yog tib txoj kev uas koj ua tau ua DDL hauv ib PL / SQL thaiv.

Pom zoo: