{"id":10789,"date":"2019-07-29T06:21:00","date_gmt":"2019-07-29T06:21:00","guid":{"rendered":"https:\/\/ittutorial.org\/?p=10789"},"modified":"2019-07-29T06:35:07","modified_gmt":"2019-07-29T06:35:07","slug":"pl-sql-programing-2","status":"publish","type":"post","link":"https:\/\/ittutorial.org\/pl-sql-programing-2\/","title":{"rendered":"PL\/SQL Programing -2"},"content":{"rendered":"<p><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">Hi, I continue to PL \/ SQL articles. If you have not read the previous article, I recommend you to start there first. In this article we will introduce PL \/ SQL a little more closely.<br \/>\n<\/span><\/span><\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"8Ob7XisvJu\"><p><a href=\"https:\/\/ittutorial.org\/pl-sql-programing-1-introduction-to-pl-sql\/\">PL\/SQL Programing -1 Introduction to PL\/SQL<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;PL\/SQL Programing -1 Introduction to PL\/SQL&#8221; &#8212; IT Tutorial\" src=\"https:\/\/ittutorial.org\/pl-sql-programing-1-introduction-to-pl-sql\/embed\/#?secret=xl7KOvWht9#?secret=8Ob7XisvJu\" data-secret=\"8Ob7XisvJu\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n<h3><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">Simple (Anonymous) Block Structure:<\/span><\/span><\/h3>\n<p><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">We also use this block structure in general one-time code execution.<\/span> <span class=\"\" title=\"\">As we will see in other block structures, they are not stored in the database as an object.<\/span><\/span><\/p>\n<p><strong>DECLARE<\/strong><\/p>\n<ul>\n<li><span class=\"tlid-translation translation\" lang=\"en\"><span title=\"\">Variables<\/span><br \/>\n<\/span><\/li>\n<li><span class=\"tlid-translation translation\" lang=\"en\"><span title=\"\">Constants<\/span><br \/>\n<\/span><\/li>\n<li><span class=\"tlid-translation translation\" lang=\"en\"><span title=\"\">Cursor<\/span><br \/>\n<\/span><\/li>\n<li><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">Error Status<\/span><\/span><\/li>\n<\/ul>\n<p><strong>BEGIN<\/strong><\/p>\n<ul>\n<li>SQL Code<\/li>\n<li>PL\/SQL Code<\/li>\n<\/ul>\n<p><strong>EXCEPTION(optional)<\/strong><\/p>\n<ul>\n<li>Error Status<\/li>\n<\/ul>\n<p><strong>END;<\/strong><\/p>\n<p><span class=\"tlid-translation translation\" lang=\"en\"><span title=\"\"><strong>DECLARE<\/strong>: Definitions of temporary fields that we will keep in Ram<\/span><\/span><\/p>\n<p><span class=\"\" title=\"\"><strong>BEGIN-END<\/strong>: This is the field where SQL and PL \/ SQL codes work, operators and loops are used in this field.<\/span><\/p>\n<p><span class=\"\" title=\"\"><strong>EXCEPTION<\/strong>: Any error conditions that may occur are captured and actions to be taken are written.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>Let&#8217;s make a example ,<\/p>\n<p>&nbsp;<\/p>\n<pre>SQL&gt; DECLARE\r\nsayi NUMBER;\r\nisim varchar2(30);\r\nBEGIN\r\nsayi:=1;\r\nisim:='Deniz Parlak';\r\nDBMS_OUTPUT.PUT_LINE(isim ||' '||sayi);\r\nEND;\r\n\/\r\n<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-8455\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/04\/Screenshot_37-1-300x137.png\" alt=\"\" width=\"687\" height=\"314\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/04\/Screenshot_37-1-300x137.png 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/04\/Screenshot_37-1.png 439w\" sizes=\"auto, (max-width: 687px) 100vw, 687px\" \/><\/p>\n<p><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">As you can see, the DBMS_OUTPUT.PUT_LINE function (the hello world of this language) is able to print the contents of our variables on the screen.<\/span><\/span><\/p>\n<p><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">Let&#8217;s make a nesting example,<br \/>\n<\/span><\/span><\/p>\n<pre>SQL&gt; DECLARE\r\n\r\n isim varchar(20); \r\n\r\nBEGIN \r\n\r\nisim:='Yasar Kemal'; \r\n\r\nDECLARE \r\n\r\neser varchar2(20); \r\n\r\nBEGIN \r\n\r\neser:='Ince Memed'; \r\n\r\nDBMS_OUTPUT.PUT_LINE(isim ||' '|| eser);\r\n\r\n END; \r\n\r\nEND; \r\n\r\n\/<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-8457\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/04\/Screenshot_38-1-300x159.png\" alt=\"\" width=\"731\" height=\"387\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/04\/Screenshot_38-1-300x159.png 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/04\/Screenshot_38-1-390x205.png 390w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/04\/Screenshot_38-1.png 448w\" sizes=\"auto, (max-width: 731px) 100vw, 731px\" \/><\/p>\n<p><span class=\"tlid-translation translation\" lang=\"en\"><span title=\"\">I&#8217;ve written a PL \/ SQL code in an easy way.<\/span> <span class=\"\" title=\"\">I will conclude this article here, and next article I will continue from the Function and Procedure block.<\/span><\/span><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi, I continue to PL \/ SQL articles. If you have not read the previous article, I recommend you to start there first. In this article we will introduce PL \/ SQL a little more closely. PL\/SQL Programing -1 Introduction to PL\/SQL Simple (Anonymous) Block Structure: We also use this block structure in general one-time &hellip;<\/p>\n","protected":false},"author":67,"featured_media":10628,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3647],"tags":[3930,3664,3626,3928,3931,3630,3658,3923,3632,5629,3929,5628,3927,5625,5626,3932,5630,3925,3709,5623,5627,3926,3720,3718,3921,3922,3924,5624,3710,5622,3933,1572,3719],"class_list":["post-10789","post","type-post","status-publish","format-standard","has-post-thumbnail","","category-pl-sql","tag-basit-plsql","tag-bastan-sona-pl-sql","tag-declare-begin-end","tag-pl-sql-case-when","tag-pl-sql-degiskenler","tag-pl-sql-dersleri","tag-pl-sql-document","tag-pl-sql-lesson","tag-pl-sql-nedir","tag-plsql-administration","tag-plsql-baslangic-dersleri","tag-plsql-case-when","tag-plsql-case-yapisi","tag-plsql-cursor","tag-plsql-declare-begin-end","tag-plsql-degisken-atama","tag-plsql-developer","tag-plsql-donguler","tag-plsql-fonksiyonlar","tag-plsql-function","tag-plsql-if-clouse","tag-plsql-if-else","tag-plsql-kitaplari","tag-plsql-kurallari","tag-plsql-learning","tag-plsql-lessons","tag-plsql-ogrenmek","tag-plsql-procedure","tag-plsql-prosedur","tag-plsql-statement","tag-set-serveroputput-on","tag-sql","tag-sql-ve-plsql"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/07\/pl-sql.png","jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/10789","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/users\/67"}],"replies":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/comments?post=10789"}],"version-history":[{"count":1,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/10789\/revisions"}],"predecessor-version":[{"id":10790,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/10789\/revisions\/10790"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/media\/10628"}],"wp:attachment":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/media?parent=10789"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/categories?post=10789"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/tags?post=10789"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}