Oracle一列的多行数据拼成一行显示字符 oracle 提供了两个函数WMSYS.WM_CONCAT 和 ListAgg函数. www.2cto.com 先介绍:WMSYS.WM_CONCAT 例: id name 1 aa 2 bb 3 cc 要的结果是"aa,bb,cc" select WMSYS.WM_CONCAT(a.name) from user a 这样的话,查询出的结果:
sql server中,返回影响行数是:If @@RowCount<1 Oracle中,返回影响行数是:If sql%rowcount<1 例: sqlserver: create procedure Proc_test , )='', AS BEGIN Update T_Mt Set Stat=@Stat,OStat=@Stat,RptTime=Getdate() Where MsgId=@MsgId --没有更新成功就插入到t_Statbuf insert into t_statbuf(M
项目过程中发现在Oracle中调用ArcSDE的st_astext函数返回ST_Geometry类型字段的WKT文本有时空间类型前缀没有返回,例如一个点的经度为113.4,纬度为30.6,调用st_astext函数正常返回就应该是“POINT(113.4 30.6)”,但有时返回的是“(113.4 30.6)”,缺少POINT前缀,以下real_st_astext函数可解决该问题. create or replace function real_st_astext(geom1 in clob)
1. 行触发器的定义 行触发器是指执行DML操作时,每作用一行就触发一次的触发器.审计数据变化时,可以使用行触发器 2. 建立行触发器的语法如下: create or replace trigger trigger_name timing event1 [or event2 event3] on table_name (referencing old as old | new as new) for each row (when condition) pl/sql block; trigger_
Description The Oracle/PLSQL TO_CHAR function converts a number or date to a string.将数字转换为日期或字符串 Syntax TO_CHAR( value [, format_mask] [, nls_language] ) Parameters or Arguments Value A number or date that will be converted to a string. format_mask O
Description The Oracle/PLSQL COUNT function returns the count of an expression. The COUNT(*) function returns the number of rows in a table that satisfy the criteria of the SELECT statement, including duplicate rows and rows containing null values in
Description The Oracle/PLSQL NVL function lets you substitute a value when a null value is encountered. NVL函数是当出现空值时替换一个值 Syntax NVL( string1, replace_with ) String1 The string to test for a null value. replace_with The value returned if string1 is n
查询表中的一个字段,返回了多行,就把这么多行的数据都拼成一个字符串. 例: id name 1 aa 2 bb 3 cc 要的结果是"aa,bb,cc" 以前有过这种需求,我用存储过程拼接,或者在程序中取出数据拼接,就这样暂时解决了. 可是事后一直在想是不是可以直接查出来,这样就简单多了,oracle中应该有这样的方法的,可是一直没找到,呵呵,今天终于解决了. select WMSYS.WM_CONCAT(a.name) fr
使用xshell等客户端登录oracl时在命令行无法使用退格键也无法使用上下键切换历史命令可以使用rlwrap解决 1,linux环境 2,下载rlwrap wget http://files.cnblogs.com/files/killkill/rlwrap-0.30.tar.gz.zip 3,解压安装 tar -xf rlwrap-0.30.tar.gz.zip cd rlwrap-0.30 ./configure make make install 4,设置环境变量 vim /home/o
https://andreynikolaev.wordpress.com/2010/10/28/appetizer-for-dtrace/ Appetizer for DTrace Filed under: DTrace,Latch — andreynikolaev @ 3:33 pm To discover how the Oracle latch works, we need the tool. Oracle Wait Interface allows us to explore the
先上语法规范: SELECT .... FROM <table-expr> PIVOT ( aggregate-function(<column>) FOR <pivot-column> IN (<value1>, <value2>,..., <valuen>) ) AS <alias> WHERE ..... 通过一个例子说明其用法: select * from (select salary, department_id
1.使用条件查询 查询部门为20的员工列表 -- 查询部门为20的员工列表 SELECT t.DEPTNO,t.ENAME FROM SCOTT.EMP t where t.DEPTNO = '20' ; 效果:2.使用 listagg() WITHIN GROUP () 将多行合并成一行(比较常用) SELECT T .DEPTNO, listagg (T .ENAME, ',') WITHIN GROUP (ORDER BY T .EN