博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[转]How do I use variables in Oracle SQL Developer?
阅读量:4562 次
发布时间:2019-06-08

本文共 1004 字,大约阅读时间需要 3 分钟。

本文转自:

Below is an example of using variables in SQL Server 2000.

DECLARE @EmpIDVar INTSET @EmpIDVar = 1234SELECT *FROM EmployeesWHERE EmployeeID = @EmpIDVar

I want to do the exact same thing in Oracle using SQL Developer without additional complexity.  It seems like a very simple thing to do, but I can't find a simple solution.  How can I do it?

 

 

You can read up elsewhere on substitution variables; they're quite handy in SQL Developer.  But I have fits trying to use bind variables in SQL Developer.  This is what I do:

SET SERVEROUTPUT ONdeclare  v_testnum number;  v_teststring varchar2(1000);begin   v_testnum := 2;   DBMS_OUTPUT.put_line('v_testnum is now ' || v_testnum);   select 36,'hello world'   INTO v_testnum, v_teststring   from dual;   DBMS_OUTPUT.put_line('v_testnum is now ' || v_testnum);   DBMS_OUTPUT.put_line('v_teststring is ' || v_teststring);end;

SET SERVEROUTPUT ON makes it so text can be printed to the script output console.

 

转载于:https://www.cnblogs.com/freeliver54/p/5344413.html

你可能感兴趣的文章
算法导论 红黑树 学习 插入(三) 图文
查看>>
mySql数据库varchar类型转int类型以及查询最大(小)值的列是varchar类型
查看>>
集合之TreeMap(含JDK1.8源码分析)
查看>>
2018/12/01 一个64位操作系统的实现 第四章 导入kernel.bin(4)
查看>>
HTML
查看>>
ORACLE创建表空间,用户及授权
查看>>
热敏网口打印机无法执行切纸指令
查看>>
壁虎书3 Classification
查看>>
壁虎书6 Decision Trees
查看>>
反射整理学习<一>(转)
查看>>
python code(1)
查看>>
利用反射生成JDK动态代理
查看>>
无奈的28句 思念的28句 痛心的28句 回忆的28句
查看>>
Django-建立网页
查看>>
iptables转发备忘
查看>>
【清华集训2016】数据交互
查看>>
备战省赛组队训练赛第七场(UPC)
查看>>
SQL puzzles and answers读书笔记——预算执行问题
查看>>
腾讯笔试
查看>>
Net基础恶补
查看>>