ORACLE1.21 PLSQL 01

-- 有了SQL 為什么還需要PL/SQL

-- SQL功能很強大,但如果是單1sql語句,沒有流程控制

?

-- PL/SQL 是什么?

--不僅僅實現流程控制,同時保留SQL本身所有的功能

--還提供變量、常量等支持

--提供更多數據類型的支持

?

--第一,學習PL/SQL塊(有開頭,有結尾,還有塊之外)

<script language=javascript>

? ...

</script>

?

int a = 3;

int a = a+3;

????? :=

?

PL/SQL塊的定義

--聲明

declare

?

begin

?

? exception

???

end;

--------

String userName = "小明";

System.out.println();

dbms?? output? put_line

變量的定義

變量的賦值1

變量的賦值2(通過查詢把,結果賦值給變量,注意,必須是單條記錄)

create table t1(

?? id number primary key,

?? user_name varchar2(20)

);

insert into t1 values(1,'小軍');

commit

select user_name from t1 where id=1

?

常量的使用

-- 會話session級別的變量

-- 宿主變量

create table tt3(

?? id number primary key,

?? user_name varchar2(20),

?? city varchar2(20),

?? is_java number,

?? is_boy number,

?? age number

);

?

insert into tt3 values(1,'小明','珠海',1,1,19);

commit;

---

declare

? show_name varchar2(100);

begin

? select user_name||' '||city into show_name from tt3 where id=1;

? dbms_output.put_line(show_name);

end;

---

?

?

?

declare

? is_java number;

? age number;

? is_java_stu boolean;

? more_than_age boolean;

? xxx varchar2(100);

begin

? select is_java,age into is_java,age from tt3 where id=1;

? is_java_stu:=? (is_java=1);

? more_than_age:= (age>18);

? if (is_java_stu and more_than_age ) then

???? select '是一個java程序員' into xxx from dual;

? else

???? select '不招' into xxx from dual;???

? end if;

? dbms_output.put_line(xxx);?

end;

轉載于:https://www.cnblogs.com/wyj1212/p/8646044.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/389985.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/389985.shtml
英文地址,請注明出處:http://en.pswp.cn/news/389985.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

云原生數據庫_數據標簽競賽云原生地理空間沖刺

云原生數據庫STAC specification is getting closer to the ver 1.0 milestone, and as such the first virtual Cloud Native Geospatial Sprint is being organized next week. An outreach day is planned on Sep 8th with a series of talks and tutorials for everyone. R…

Linux 下的 hosts文件

2019獨角獸企業重金招聘Python工程師標準>>> hosts 文件 目錄在 /etc/hosts netstat -ntlp //linux 下查看端口 轉載于:https://my.oschina.net/u/2494575/blog/1923074

412. Fizz Buzz

412. Fizz Buzz 給你一個整數 n &#xff0c;找出從 1 到 n 各個整數的 Fizz Buzz 表示&#xff0c;并用字符串數組 answer&#xff08;下標從 1 開始&#xff09;返回結果&#xff0c;其中&#xff1a; answer[i] “FizzBuzz” 如果 i 同時是 3 和 5 的倍數。answer[i] “…

DjangoORM字段介紹

轉載于:https://www.cnblogs.com/cansun/p/8647371.html

黑客獨角獸_雙獨角獸

黑客獨角獸Preface前言 Last week my friend and colleague Srivastan Srivsan’s note on LinkedIn about Mathematics and Data Science opened an excellent discussion. Well, it is not something new; there were debates in the tech domain such as vim v.s emacs to …

38. 外觀數列

38. 外觀數列 給定一個正整數 n &#xff0c;輸出外觀數列的第 n 項。 「外觀數列」是一個整數序列&#xff0c;從數字 1 開始&#xff0c;序列中的每一項都是對前一項的描述。 你可以將其視作是由遞歸公式定義的數字字符串序列&#xff1a; countAndSay(1) “1”countAnd…

JavaScript進階(一)--執行上下文

在下工科生一枚&#xff0c;自認為文筆爛大街&#xff01;本著總結JavaScript原理知識&#xff0c;提升自我寫作水平的目的&#xff0c;提筆寫下這幾篇文章&#xff0c;噴子們高抬貴手?。寫作過程中本系列過程中&#xff0c;我會盡快寫完全部內容&#xff0c;再回過頭來優化補…

Lab1

1.導入 JUnit&#xff0c;Hamcrest Project -> Properites -> Java Build Path -> Add External JARs 2. 安裝 Eclemma Help -> Eclipse marketplace 搜索 Eclemma&#xff0c;點擊Installed 3. 測試代碼 TrianglePractice&#xff1a; public class TrianglePract…

抽象類細分舉行_什么是用聚類技術聚類的客戶細分

抽象類細分舉行This content was originally posted in Spanish here https://blogs.solidq.com/es/poder-del-dato/que-es-el-clustering-segmenta-a-tus-clientes-con-machine-learning/此內容最初以西班牙語發布在此處https://blogs.solidq.com/es/poder-del-dato/que-es-el…

551. Student Attendance Record I 從字符串判斷學生考勤

&#xff3b;抄題&#xff3d;&#xff1a; You are given a string representing an attendance record for a student. The record only contains the following three characters: A : Absent. L : Late.P : Present. A student could be rewarded if his attendance record…

使用deploy命令上傳jar到私有倉庫

打開cmd命令提示符&#xff0c;mvn install是將jar包安裝到本地庫&#xff0c;mvn deploy是將jar包上傳到遠程server&#xff0c;install和deploy都會先自行bulid編譯檢查&#xff0c;如果確認jar包沒有問題&#xff0c;可以使用-Dmaven.test.skiptrue參數跳過編譯和測試。 全命…

282. 給表達式添加運算符

282. 給表達式添加運算符 給定一個僅包含數字 0-9 的字符串 num 和一個目標值整數 target &#xff0c;在 num 的數字之間添加 二元 運算符&#xff08;不是一元&#xff09;、- 或 * &#xff0c;返回所有能夠得到目標值的表達式。 示例 1:輸入: num "123", targ…

java 在底圖上繪制線條_使用底圖和geonamescache繪制k表示聚類

java 在底圖上繪制線條This is the third of four stories that aim to address the issue of identifying disease outbreaks by extracting news headlines from popular news sources.這是四個故事中的第三個&#xff0c;旨在通過從流行新聞來源中提取新聞頭條來解決識別疾病…

python selenium處理JS只讀(12306)

12306為例 js "document.getElementById(train_date).removeAttribute(readonly);" driver.execute_script(js)time2獲取當前時間tomorrow_time 獲取明天時間 from selenium import webdriver import time import datetime time1datetime.datetime.now().strftime(&…

Mac上使用Jenv管理多個JDK版本

使用Java時會接觸到不同的版本。大多數時候我在使用Java 8&#xff0c;但是因為某些框架或是工具的要求&#xff0c;這時不得不讓Java 7上前線。一般情況下是配置JAVA_HOME&#xff0c;指定不同的Java版本&#xff0c;但是這需要人為手動的輸入。如果又要選擇其他版本&#xff…

交互式和非交互式_發布交互式劇情

交互式和非交互式Python中的Visual EDA (Visual EDA in Python) I like to learn about different tools and technologies that are available to accomplish a task. When I decided to explore data regarding COVID-19 (Coronavirus), I knew that I would want the abilit…

5886. 如果相鄰兩個顏色均相同則刪除當前顏色

5886. 如果相鄰兩個顏色均相同則刪除當前顏色 總共有 n 個顏色片段排成一列&#xff0c;每個顏色片段要么是 ‘A’ 要么是 ‘B’ 。給你一個長度為 n 的字符串 colors &#xff0c;其中 colors[i] 表示第 i 個顏色片段的顏色。 Alice 和 Bob 在玩一個游戲&#xff0c;他們 輪…

Sunisoft.IrisSkin.SkinEngine 設置winform皮膚

Sunisoft.IrisSkin.SkinEngine se; se new Sunisoft.IrisSkin.SkinEngine { SkinAllForm true, SkinFile "..\..\skin\EmeraldColor2.ssk" };Sunisoft.IrisSkin.SkinEngine skin new Sunisoft.IrisSkin.SkinEngine(); //具體樣式文件 地址&#xff0c;可以自行修…

docker 相關操作

docker-compose down //關閉所有容器 docker-compose up //開啟所有容器docker-compose restart //重啟所有容器單獨更新某個容器時用腳本$ docker ps // 查看所有正在運行容器 $ docker stop containerId // containerId 是容器的ID$ docker ps -a // 查看所有容器 $…

電子表格轉換成數據庫_創建數據庫,將電子表格轉換為關系數據庫,第1部分...

電子表格轉換成數據庫Part 1: Creating an Entity Relational Diagram (ERD)第1部分&#xff1a;創建實體關系圖(ERD) A Relational Database Management System (RDMS) is a program that allows us to create, update, and manage a relational database. Structured Query …