关于ORA-00907: missing right parenthesis问题整理
来源:互联网 发布:java鱼雷好吗 编辑:程序博客网 时间:2024/05/22 02:29
昨天我在写存储过程的时候,在把系统时间格式转换用于与数据库字段做比较,当我test时抛出ORA-00907: missing right parenthesis,缺省右括号;
下面是我的出错代码:
dynamic_sql := 'select t3.departmentcode, t3.total from (select departmentcode,count(*) total from ' || str_tablename || ' where (LASTUPDATEDTIME between to_date(to_char(sysdate-1,"yyyy-mm-dd") ,''yyyy-mm-dd'') and to_date(to_char(sysdate,"yyyy-mm-dd") ,''yyyy-mm-dd'')) and departmentcode is not NULL group by departmentcode) t3,v_s_data_input_dept_usernum t4 where t3.departmentcode = ' || str_departmentcode || '';
更正后,执行成功的代码:
dynamic_sql := 'select t3.departmentcode, t3.total from (select departmentcode,count(*) total from ' || str_tablename || ' where (LASTUPDATEDTIME between to_date(''' || to_char(sysdate-1,'yyyy-mm-dd') || ''',''yyyy-mm-dd'') and to_date(''' || to_char(sysdate,'yyyy-mm-dd') || ''',''yyyy-mm-dd'')) and departmentcode is not NULL group by departmentcode) t3,v_s_data_input_dept_usernum t4 where t3.departmentcode = ' || str_departmentcode || '';
红色的部分对比
希望对出现类似错误的有所帮助
----------------
还有第二种情况
(Oracle测试)使用SQL语句的select语句是经常会用到字段和表的的别名,使用要注意,字段的别名前面可以加as关键字,或是省略不写,但是表名的别名前面不可以加as,否则会报如下错误:
命令出错, 行: 11 列: 20
错误报告:
SQL 错误: ORA-00907: 缺失右括号
00907. 00000 - "missing right parenthesis"
*Cause:
*Action:
- 关于ORA-00907: missing right parenthesis问题整理
- 关于Ibatis ORA-00907: missing right parenthesis
- ORA-00907: missing right parenthesis
- ORA-00907: missing right parenthesis
- ORA-00907: missing right parenthesis
- ORA-00907:missing right parenthesis
- ora-ORA-00907 missing right parenthesis
- Oracle ERROR:ORA-00907: missing right parenthesis
- ibatis ORA-00907: missing right parenthesis错误
- MYSQL数据迁移tips,ORA-00907: missing right parenthesis
- Oracle 11g: ORA-00907: missing right parenthesis solution
- java.sql.SQLException: ORA-00907: missing right parenthesis
- Oracle Exception:missing right parenthesis
- 转义字符起引的“missing right parenthesis”错误
- 在子查询中使用 order by 总是告错:ORA-00907: missing right parenth.解决办法!
- ORA-00907: 缺失右括号问题整理解决
- Parenthesis
- Parenthesis
- 工作一年多了,突然想总结下
- 学习MongoDB--(7-1):进阶指南(数据库命令 & 固定集合)
- WebLogic 11g重置用户密码
- 条件锁pthread_cond_t 的应用
- Framebuffer Driver
- 关于ORA-00907: missing right parenthesis问题整理
- Java 观察者模式 简单例子
- jsp介绍
- 邻接矩阵存储结构 和 邻接表存储结构 的深度优先搜索遍历
- DOS命令(经典收藏)
- MD5加密
- Redis数据库学习笔记
- eclipse 搭建C++开发环境
- 命令历史