import cx_Oracle

conn = cx_Oracle.connect("scott/admin@localhost:1521/orcl")
cursor = conn.cursor()

sql = "select ascii('Z'),ascii('H'),ascii('D'),ascii(' ') from dual"
cursor.execute(sql)
result = cursor.fetchall()
for i in result:
print(i)

sql = "select chr(90),chr(72),chr(32) from dual"
cursor.execute(sql)
result = cursor.fetchall()
for i in result:
print(i)

sql = "select concat('Hello','World') from dual"
cursor.execute(sql)
result = cursor.fetchall()
for i in result:
print(i)

sql = "select initcap('oh my god!') from dual"
cursor.execute(sql)
result = cursor.fetchall()
for i in result:
print(i)

sql = "select instr('oracle 11g','1',3,2) from dual"
cursor.execute(sql)
result = cursor.fetchall()
for i in result:
print(i)

sql = "select e.empno,e.ename,d.dname from emp e inner join dept d on e.deptno=d.deptno where length(e.ename)>5"
cursor.execute(sql)
result = cursor.fetchall()
for i in result:
print(i)

import cx_Oracle

conn = cx_Oracle.connect("hr/admin@localhost:1521/orcl")
cursor = conn.cursor()

sql = "select employee_id,lower(first_name),upper(last_name) from employees where lower(first_name) like 'a%'"
cursor.execute(sql)
result = cursor.fetchall()
for i in result:
print(i)

sql = "select ltrim('##########Eas###########','#'),rtrim('East ') from dual"
cursor.execute(sql)
result = cursor.fetchall()
for i in result:
print(i)

sql = "select replace('Bad Luck Bad Gril','Bad','Good') from dual"
cursor.execute(sql)
result = cursor.fetchall()
for i in result:
print(i)

sql = "select substr('MessageBox',8,3) from dual"
cursor.execute(sql)
result = cursor.fetchall()
for i in result:
print(i)

sql = "select ceil(7.3),ceil(7),ceil(-7.3) from dual"
cursor.execute(sql)
result = cursor.fetchall()
for i in result:
print(i)

sql = "select round(3.1415926,2) from dual"
cursor.execute(sql)
result = cursor.fetchall()
for i in result:
print(i)

sql = "select power(2,3) from dual"
cursor.execute(sql)
result = cursor.fetchall()
for i in result:
print(i)

sql = "select sysdate from dual"
cursor.execute(sql)
result = cursor.fetchall()
for i in result:
print(i)

sql = "select ADD_MONTHS(sysdate,6) from dual"
cursor.execute(sql)
result = cursor.fetchall()
for i in result:
print(i)

sql = "select sysdate,to_char(sysdate,'YYYY-MM-DD') from dual"
cursor.execute(sql)
result = cursor.fetchall()
for i in result:
print(i)
print(result[0][1])

sql = "select to_number('18f','xxx') from dual"
cursor.execute(sql)
result = cursor.fetchall()
for i in result:
print(i)

import cx_Oracle

conn = cx_Oracle.connect("scott/admin@localhost:1521/orcl")
cursor = conn.cursor()

sql = "select count(empno),round(avg(sal),2) from emp"
cursor.execute(sql)
result = cursor.fetchall()
for i in result:
print(i)

吴裕雄 python oracle检索数据(2)的更多相关文章

  1. 吴裕雄 python oracle检索数据(1)

    import cx_Oracle conn = cx_Oracle.connect("scott/admin@localhost:1521/ORCL")cursor = conn. ...

  2. 吴裕雄 python oracle操作数据库(4)

    import cx_Oracle conn = cx_Oracle.connect("scott/admin@localhost:1521/orcl")cursor = conn. ...

  3. 吴裕雄 python oracle子查询的用法(3)

    import cx_Oracle conn = cx_Oracle.connect("scott/admin@localhost:1521/orcl")cursor = conn. ...

  4. Oracle 检索数据(查询数据、select语句)

    用户对表或视图最常进行的操作就是检索数据,检索数据可以通过 select 语句来实现,该语句由多个子句组成,通过这些子句完成筛选.投影和连接等各种数据操作,最终得到想要的结果. 语法: select ...

  5. 吴裕雄 python 机器学习——数据预处理过滤式特征选取SelectPercentile模型

    from sklearn.feature_selection import SelectPercentile,f_classif #数据预处理过滤式特征选取SelectPercentile模型 def ...

  6. 吴裕雄 python 机器学习——数据预处理过滤式特征选取VarianceThreshold模型

    from sklearn.feature_selection import VarianceThreshold #数据预处理过滤式特征选取VarianceThreshold模型 def test_Va ...

  7. 吴裕雄 python 机器学习——数据预处理正则化Normalizer模型

    from sklearn.preprocessing import Normalizer #数据预处理正则化Normalizer模型 def test_Normalizer(): X=[[1,2,3, ...

  8. 吴裕雄 python 机器学习——数据预处理标准化MaxAbsScaler模型

    from sklearn.preprocessing import MaxAbsScaler #数据预处理标准化MaxAbsScaler模型 def test_MaxAbsScaler(): X=[[ ...

  9. 吴裕雄 python 机器学习——数据预处理标准化StandardScaler模型

    from sklearn.preprocessing import StandardScaler #数据预处理标准化StandardScaler模型 def test_StandardScaler() ...

随机推荐

  1. mapreduce运行原理及YARN

    mapreduce1回顾 mapreduce1的不足 yarn的基本架构 yarn工作流程

  2. Linux RPS/RFS 实现原理浅析

    本文快速解析一下RPS/RFS的基本原理. RPS-Receive Packet Steering 下面这个就是RPS的原理:  其实就是一个软件对CPU负载重分发的机制.其使能的作用点在CPU开始处 ...

  3. RSA加密解密,String转PublicKey、PrivateKey;附Base64.JAR

    网络请求的数据需要加密,服务器给的他们那一套在Android一直报错,自己写了一个: package com.cc.common.util; import javax.crypto.Cipher; i ...

  4. angularjs指令中的scope

    共享 scope 使用共享 scope 的时候,可以直接从父 scope 中共享属性.因此下面示例可以将那么属性的值输出出来.使用的是父 scope 中定义的值. js代码: app.controll ...

  5. JVM总结-垃圾回收

    Java 虚拟机的自动内存管理,将原本需要由开发人员手动回收的内存,交给垃圾回收器来自动回收.不过既然是自动机制,肯定没法做到像手动回收那般精准高效 [1] ,而且还会带来不少与垃圾回收实现相关的问题 ...

  6. 1.理解Numpy、pandas

    之前一直做得只是采集数据,而没有再做后期对数据的处理分析工作,自己也是有意愿去往这些方向学习的,最近就在慢慢的接触. 首先简单理解一下numpy和pandas:一.NumPy:1.NumPy是高性能计 ...

  7. 48.纯 CSS 创作一盘传统蚊香

    原文地址:https://segmentfault.com/a/1190000015246974 感想: 都是半圆边框合成的. HTML code: <div class="coil& ...

  8. java中的排序--排序容器_TreeSet与TreeMap

    1.TreeSet:数据元素可以排序且不可重复. 对比: (1)Set接口:HashSet,元素必须重写hashcode和equals方法. (2)TreeSet:只要可以排序即可.去重:比较等于0即 ...

  9. windows2012系统IE浏览器无法打开加载flashplayer内容

    添加角色和功能,用户界面和基础结构,桌面体检,安装完重启电脑

  10. jenkins部署配置

    https://www.cnblogs.com/rslai/p/8135460.html 修改jenkins的默认端口号: https://blog.csdn.net/qq_32440951/arti ...