如何将整行(在SQL中,而不是PL/SQL中)传递给存储的函数? [英] How to pass an entire row (in SQL, not PL/SQL) to a stored function?

查看:102
本文介绍了如何将整行(在SQL中,而不是PL/SQL中)传递给存储的函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到以下(非常简单)的问题.我想编写一个(Oracle)SQL查询,大致如下:

I am having the following (pretty simple) problem. I would like to write an (Oracle) SQL query, roughly like the following:

SELECT count(*), MyFunc(MyTable.*)
FROM MyTable
GROUP BY MyFunc(MyTable.*)

在PL/SQL中,可以使用RECORD类型(和/或%ROWTYPE),但是据我所知,这些工具在SQL中不可用.但是,该函数需要完整的行.如何将整个行传递给存储的函数?

Within PL/SQL, one can use a RECORD type (and/or %ROWTYPE), but to my knowledge, these tools are not available within SQL. The function expects the complete row, however. What can I do to pass the entire row to the stored function?

谢谢!

推荐答案

不要以为可以.

要么使用所需的所有参数创建函数,要么传递行的ID,然后在函数内执行SELECT.

Either create the function with all the arguments you need, or pass the id of the row and do a SELECT within the function.

这篇关于如何将整行(在SQL中,而不是PL/SQL中)传递给存储的函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆