douyakan8924 2017-07-17 19:20
浏览 75
已采纳

SQL查询没有正确提取数据

ID MAIL KEY                                                                                                                                  
1.7072E arnold.palmer@golf.com 48EF071156D86C05334D6E18A05E557129F51A6F10183AFAB14BD7581C58365D                                                                            
1.7071E arnold.dailey@golf.com 2445616C8C13B985ADE534B7550EA0938761BCBC7E99506E6F3D72275DA33FEC                                                                            

I have this table in my db. I use

SELECT ID, MAIL, KEY FROM Table WHERE MAIL='arnold.palmer@golf.com';

if($row = oci_fetch_array($parsed_sql, OCI_BOTH+OCI_RETURN_NULLS+OCI_RETURN_LOBS)) {
            $ID = $row['ID'];
            $key = $row['KEY'];                                   
            print($ID.' ->'.$key);

this print out 1.7072E -> $Eal�����4�U���a��~�Pno=r']�?�

Can anyone help me understand why I am getting that specific data over the hash that is in the database? I'm certain it is due to the data type being RAW, however when i try UTL_RAW.CAST_TO_VARCHAR2 It comes back undefined var.

  • 写回答

1条回答 默认 最新

  • dppx9253 2017-07-17 20:14
    关注

    Changing my SELECT statement to:

    SELECT ID, MAIL, RAWTOHEX(KEY) AS KEY FROM Table WHERE MAIL=:MAIL
    

    now gives me the proper hash output. The issue without Aliasing is why the variable was undefined.

    $key = $row['KEY'];
    

    without the alias PHP wasn't getting the right "field".

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 win32如何自绘编辑框的背景图片(语言-c++|操作系统-windows)
  • ¥15 微信夜间被转走了1w对,当天手机剪切板里就出现了这个乱码,有铁子可以看看是啥吗可以
  • ¥50 跑通github上的代码 深度学习 pytorch
  • ¥50 求写,批处理调用分区助手分区脚本
  • ¥15 求购HI3519AV100开发板
  • ¥15 请问1553 RT怎么测试,没有BC有方法吗
  • ¥100 业务编程如何选择学习方向和内容?
  • ¥15 wamp3.3.5安装完成后图标正常显示绿色,鼠标左右键点击图标均无反应。求解决方法。
  • ¥15 鼠标点击的这条记录了什么?
  • ¥15 在写pid调速的程序时,电机始终维持最大速度