在search_condition的值之后查询Oracle约束
我想在 Oracle SQL 中找到具有特定 search_condition 的约束。像这样的事情:
SELECT constraint_name, constraint_type,search_condition
FROM USER_CONSTRAINTS
WHERE table_name ='MYTABLE' AND search_condition = '"myColumn" IS NOT NULL';
问题是我收到错误“非法使用数据类型 LONG”。
我希望有一个可行的替代方案。谢谢!
I want to find a constraint in Oracle SQL that has a certain search_condition. Something like this:
SELECT constraint_name, constraint_type,search_condition
FROM USER_CONSTRAINTS
WHERE table_name ='MYTABLE' AND search_condition = '"myColumn" IS NOT NULL';
Problem is i get error "Ilegal use of datatype LONG".
I'd appreciate a working alternative. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
修改 WHERE 子句的后半部分,如下所示
search_condition 是 LONG 数据类型,这相当限制了您可以用它做什么。 SUBSTR 的最后一个参数给出了返回的字符串的长度,因此请根据需要进行修改。
修改为我忘记了对 WHERE 子句的限制,基本上创建一个 PL/SQL 函数来执行上述操作并在 WHERE 子句中使用它,
例如
,如此处使用的...
Amend the second half of your WHERE clause as follows
search_condition is a LONG datatype and that rather limits what you can do with it. the last parameter of the SUBSTR gives the length of the string returned so amend that as needed.
Amended as I'd forgotten the restriction on WHERE clauses, basically create a PL/SQL function to do the above and use that in your WHERE clause,
For example
As used here....
使用
可以看到 search_condition 是 LONG 类型。
在 Oracle 12 上:search_condition_vc 将是解决方案。
use
to see that search_condition is of type LONG.
On Oracle 12 :search_condition_vc would be the solution.
显然你需要使用 PL/SQL。请参阅此处的示例:
http://www.orafaq.com/forum/m/110779/43055/?srch=instr+long#msg_110779" orafaq.com/forum/m/110779/43055/?srch=instr+long#msg_110779
本质上,您不能在 where 子句中使用 LONG。
You need to use PL/SQL apparently. See here for the example:
http://www.orafaq.com/forum/m/110779/43055/?srch=instr+long#msg_110779
Essentially you cannot use LONGs in where clauses.