关于ORACLE PLSQL读文件
转自:http://www.oracle.com/technology/obe/obe9ir2/obe-cnt/plsql/plsql.htm
都说读书不求甚解害死人,一点也不错,最近我从网上淘到关于ORACLE如何从数据库目录下读文件,于是就用于生产了,结果上了生产,程序死活就是跑不出来,原因是我们的服务器做了REC,如果在两台机器上找一个目录呢,以前呢在自己的程序里把路径写死了,在一般服务器上验证也没有问题,可是如果是双机呢?就不行了,那我们只好通过共享目录来实现,可是有了目录,程序还是找不到绝对路径,怎么办呢,看下面的程序,它都是在数据库里创建了一个DIRECTORY,修改成它,问题迎刃而解。
通过下面的例子,好好研究一下ORACLE提供给我们的功能吧!
Using New PL/SQL Features to Enhance Applications
Module Objectives
Purpose
This module describes how to utilize some of the latest PL/SQL capabilities to optimize performance and increase the efficiency of your PL/SQL applications..
Objectives
Upon completion of this module, you should be able to:
Use an Associative Array
Use the UTL_FILE package to manage access to directories, handle raw data, and copy, rename and delete files
Use Bulk binding in native dynamic SQL
Use PL/SQL RECORDs to access and manipulate changes to the database
Prerequisites
The prerequisites for this lesson are:
Completed the Preinstallation Tasks module
Completed the Installing the Oracle9i Database module
Download and unzip plsql.zip into your working directory
Reference Material
The following list represents some useful reference material should you need additional information on the topics in this module:
Documentation: PL/SQL User's Guide and Reference
Documentation: Supplied PL/SQL Packages and Types Reference
PL/SQL Whitepapers and Code Examples on OTN
Overview
The features you will explore in this lesson are:
1.
Using Associative Arrays
2.
Using the UTL_FILE Package
3.
Using Bulk Binding in Native Dynamic SQL
4.
Using PL/SQL Records
Using Associative Arrays
Back to List
In Oracle9i Database Release 2, PL/SQL index-by tables, now known as associative arrays, have been extended to allo
相关文档:
http://www.diybl.com/course/7_databases/oracle/oraclejs/2007614/52942.html
摘要:在大量业务数据处理的项目中,可以考虑使用分区表来提高应用系统的性能并方便数据管理,本文详细介绍了分区表的使用。
在大型的企业应用或企业级的数据库应用中,要处理的数据量通常可以达到几十到几百GB,有的甚至可以到T ......
1.oracle字符集问题:
数据库字符集为ZHS16BGK,汉字在数据库存放的时候占用两个字节
数据库字符集为UTF8,汉字在数据库里存放的时候占用三个字节
由于字符集不同,导致现在数据库IMP的时候有些表的字段长度不够,出现ORA-12899: value too large for column的错误。
通过修改字符集可以解决这种问题。
2.utf-8和unico ......
Oracle 9i共提供了16种标量数据类型,如表7.4所示。
表7.4 Oracle 9i的标量数据类型
名称
含义
Char
用于描述定长的字符型数据,长度<=2000字节
varchar2
用于描述变长的字符型数据,长度<=4000字节
nchar
用来存储Unicode字符集的定长字符型数据,长度<=1000字节
nvarchar2
用来存储Un ......
(1)以SYS身份登陆
conn sys/sysem_pwd as sysdba;
(2)创建amly用户
create user amly identified by 9imly;
(3)创建表空间
create tablespace ts_amly datafile 'd:\amlyfile\test.dbf' size 100M;
(4)将表空间分配给用户
alter user amly default tablespace ts_amly;
(5)给用户授权
grant create sess ......
该函数用来返回一个四舍五入后的值
SELECT ROUND( number, [ decimalplaces ] ) from DUAL
參數:
必填项:number : 要处理的数值(数值表达式)
可选项:decimalplaces : 四舍五入时取的小数的位数,不填则返回整数
Sample :
select round(123.456) from dual;& ......