用户评论:

luismanuelp at gmail dot com (2005-08-26 08:05:09)

I am trying to get a list of the first character of a character string.

SELECT distinct substr(version,1,1) as COL1 FROM SPHVVERS where Version is not null order by 1

This was working and then failed recently. I think it is because some of the strings now added contain a number as the first character.

I found to get it to work I had to use decode statement. (To_Char did not work )

SELECT distinct decode (substr(version,1,1),'1','?','0','!',substr(version,1,1)) as COL1 FROM SPHVVERS where Version is not null order by 1

gabi at gambita dot de (2003-09-01 09:31:40)

if you want to join two tables having both the same column (e.g. 'id') but you don't want to (or cannot) specify all the other fields in these two tables (like erabbott mentioned), you can use:

SELECT t1.*, t2.*, t1.id AS id1, t2.id AS id2

FROM table1 t1, table2 t2;

Note that this does _not_ work:

SELECT *,t1.id AS id1, t2.id AS id2

FROM table1 t1, table2 t2;

jthome at fcgov dot com (2003-02-10 14:56:23)

FYI--

In order to modify Oracle dates (using NLS_DATE_FORMAT...), you must set $ORACLE_HOME first. This environmental variable is best set in the server startup script (i.e., ./apachectl)

--

Jim

erabbott at NOSPAMterra dot com dot br (2002-09-27 07:22:44)

As in my previous post, the same thing applies when using conversion functions in CLOB columns.

Probably the same thing will occur to any conversion function that you use.

So, this wont work

SELECT ... TO_CHAR(MY_CLOB) ...

$my_clob = OCIResult($stmt,"MY_CLOB");

But this will:

SELECT ... TO_CHAR(MY_CLOB) AS MYC ...

$my_clob = OCIResult($stmt,"MYC");

Best regards.

erabbott at NOSPAMterra dot com dot br (2002-09-26 15:35:48)

Note that if you are making multiple table selects, you must specify an alias to each column.

This wont work:

----------------------------------------

$qry = "SELECT A.COL_ONE, B.COL_ONE FROM TABLE1 A, TABLE2 B";

$stmt = OCIParse($conn, $qry);

while(OCIFetch($stmt))

{

$a = OCIResult($stmt, "A.COL_ONE");

...

----------------------------------------

But this will:

----------------------------------------

$qry = "SELECT A.COL_ONE AS X, B.COL_ONE AS Y FROM TABLE1 A, TABLE2 B";

$stmt = OCIParse($conn, $qry);

while(OCIFetch($stmt))

{

$a = OCIResult($stmt, "X");

...

----------------------------------------

Regards,

steve dot hurst at instem-lss dot co dot uk (2002-03-28 07:35:39)

I am trying to get a list of the first character of a character string.

SELECT distinct substr(version,1,1) as COL1 FROM SPHVVERS where Version is not null order by 1

This was working and then failed recently. I think it is because some of the strings now added contain a number as the first character.

I found to get it to work I had to use decode statement. (To_Char did not work )

SELECT distinct decode (substr(version,1,1),'1','?','0','!',substr(version,1,1)) as COL1 FROM SPHVVERS where Version is not null order by 1

dwilson at cae dot wisc dot edu (2001-04-16 18:05:40)

I complained that I couldn't get the time from an Oracle date field. Joe Brown said:

This is not a PHP bug.

Consider setting NLS_DATE_FORMAT.

The manual states OCIResult() returns everything as a string.

NLS_DATE_FORMAT may not be appropriate for your needs.

There are quite a few places you can set NLS_DATE_FORMAT.

* Environment variables (or windows registry on win32)

* orclSID.ora

* on a per session basis; execute this statement after logon:

$cursor=OCIParse($connection,

"ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'");

OCIExecute($cursor);

OCIFreeCursor($cursor);

shayman at quiver dot com (2000-08-30 09:09:10)

As this function gets a 'mixed' variable type for the column index, you may use an integer to represent the column number. In this case, the count is starting from 1 and not from zero.

I am not sure, but I think this method is a bit faster than using the column name.

For an example, see the OCINumCols first example.

Maxwell_Smart at ThePentagon dot com (2000-08-18 16:49:33)

On the column names needing to be all caps. Just a guess.

Oracle is case sensitive when columns are created with quotes around them. When they are created without quotes around them, they are case insensitive. However, Oracle will always display them as being all caps.

If PHP referes to a column, it probably gets the case from Oracle. Then since PHP is case sensitive, you have ot supply it in all caps.

dominic dot standage at revolutionltd dot com (1999-09-16 05:43:57)

OCIResult() requires the column name to be written in capitals, so OCIResult($stmt,"column") won't work, but OCIResult($stmt,"COLUMN") works fine. Hope that helps somebody out

php中result的值,PHP 返回所取得行中字段的值相关推荐

  1. CAD入门攻略:CAD软件中动态输入坐标与在CAD命令行中输入坐标的区别

    浩辰CAD软件提供了动态输入功能,动态输入可以让我们将注意力集中到图面上,在绘制图纸的过程中不必经常看CAD命令行,从而提高绘图效率.但什么时候是相对坐标,什么时候是绝对坐标,对图纸绘制也是有所影响的 ...

  2. MYSQL-交换表中2行2字段的值

    需求场景: 当表中的一个字段存储当前记录的顺序或者排名时候,它需要进行上移或者下移,或者直接和某个记录交换值的时候,通常可以立刻想到以下的SQL操作语句. CREATE TABLE coordinat ...

  3. 查看当前目录下所有.log文件,返回后10行中带有关键字error或exception的文件名

    1.汇总需要检查的文件名到filename.txt 2.创建最终结果文件re,一天一个(也可以精确到秒,看情况吧) 3.清空结果文件re,免得重跑时结果文件re有内容 4.遍历文件列表filename ...

  4. c语言中空格与nul,NUL字符在命令行中的重用

    NUL是C语言中的"字符串"(C语言中并没有字符串这种数据类型)结束标志字符.ASCII为0, 在数字系统中,处理边界的那些值往往是特别的. UNIX中真正不能作为文件名和目录名的 ...

  5. java根据值获取枚举_java – 我可以根据其字段的值获取枚举吗?

    我想根据其字段值获取一个特定的枚举. 枚举: public enum CrimeCategory { ASBO ("Anti Social BehavIoUr"),BURG (&q ...

  6. linux中 p的作用,使用ctop在命令行中检测Linux容器性能

    ctop是一个新的基于命令行的工具,它可用于在容器层级监控进程.容器通过利用控制器组(cgroup)的资源管理功能,提供了操作系统层级的虚拟化环境.该工具从cgroup收集与内存.CPU.块输入输出的 ...

  7. 从sqlserver中数据写入mysql_[SQL Server]SQL Server数据库中如何返回INSERT INTO语句插入/写入数据后的记录值(比如ID等)?...

    问题描述 SQL Server数据库中,有时候当我们使用INSERT INTO语句写入数据后,需要返回写入数据对应的自增ID或者GUID,以便根据此记录进行后续的操作.那么SQL语句如何实现返回记录值 ...

  8. mysql判断存在返回布尔_MySqlClient访问tinyint字段返回布尔值篇

    症状: 使用MySqlClient访问tinyint unsign 字段返回布尔值 true 和 false,但是实际上该字段存储值为1-255 分析: 由于在Mysql中没有布尔类型值,MySqlC ...

  9. lrange是取出所有值并移除么_TCL中的列表修改命令lrange、linsert、lreplace、lset和 lappend | 坐倚北风...

    TCL中用于修改列表的命令有五个:lrange.linsert. lreplace.lset和 lappend. lrange命令返回列表中某范围内的元素.它获取的参数包括一个列表和两个索引值,返回的 ...

最新文章

  1. Java项目:个人博客系统(前后端分离+java+vue+Springboot+ssm+mysql+maven+redis)
  2. 速来围观MOS管的选择步骤
  3. 设置电脑背景颜色为保护眼睛的颜色
  4. centos 无法连接网络
  5. Django中的cookie与session
  6. 阿里巴巴为什么选择Apache Flink?
  7. Javashop 7.0 商城更改logo、名字修改方法
  8. 上海旅行日志 2012年7月14日
  9. linux/unix系统下IOZONE/iozone磁盘性能测试工具方法
  10. 「luogu4093」[HEOI2016/TJOI2016]序列
  11. (附源码)spring boot基于Java的电影院售票与管理系统毕业设计 011449
  12. Pilosa文档翻译(二)入门指南
  13. iPhone无法联网问题
  14. 用树莓派做linux电视盒子,用树莓派制造一台“口袋电视”
  15. 1期精彩推荐:如何应对工作中的冲突?
  16. 易语言人脸识别算法源码
  17. Linux 命令积累(当作笔记)
  18. wget 下载失败,使用“--no-check-certificate”,/C=US/O=Let‘s Encrypt/CN=R3” 颁发的证书
  19. windows 10企业版windows Defender无法使用
  20. leetcode.377. 组合总和 Ⅳ---dp问题

热门文章

  1. C#之获取系统cpu
  2. J2EE技术-Hibernate
  3. elementUI压缩图片和将图片转成base64格式
  4. mac 看端口占用并杀死进程
  5. Android导入第三方类库
  6. c语言gets,getc,C语言的getc()函数和gets()函数的使用对比
  7. xilinx set up debug
  8. C语言---数字迷宫
  9. 服务器上登录网页ip地址,查看服务器上登录的ip地址
  10. matlab仿真限幅发散,GSM通信系统性能分析与MATLAB仿真.doc