Catching collection returned by function in SQL statement
I am having a select query as : (I need all the values returned by the function in the select list)
select t1.col1,t2.col2, (select t.a,t.b,t.c from fn(t2.col3) t)
from
t1,t2
where t1.col1=t2.col2;
My function is like :
fn(t2.col3) returns a table in object format
Here I was able to select only one value from table returned by the funcation at a time.If I select all the values as above it was giving too many vales error.
Please any one help me in this
user13044793 wrote:
I am having a select query as : (I need all the values returned by the function in the select list)
select t1.col1,t2.col2, (select t.a,t.b,t.c from fn(t2.col3) t)
from
t1,t2
where t1.col1=t2.col2;Any specific reason for doing this? It adds an additional complexity to the SQL projection, and there's the additional costs of context switching to the PL/SQL engine (per row). All in all - not your typical approach and one that should have sound justification.
As for the basic method - the multiset() SQL function needs to be used to create a collection. Here's a basic example of the approach:
SQL> create or replace type TFoo as object(
2 id number,
3 bar varchar2(5)
4 );
5 /
Type created.
SQL>
SQL> create or replace type TFooSet as table of TFoo;
2 /
Type created.
SQL>
SQL> create or replace function GetSomeFoo( n number ) return TFooSet is
2 foo TFooSet;
3 begin
4 foo := new TFooSet();
5 foo.Extend( 5 );
6
7 for i in 1..5
8 loop
9 foo(i) := new TFoo( n+i-1, to_char(i-1,'0000') );
10 end loop;
11
12 return( foo );
13 end;
14 /
Function created.
SQL>
SQL> select
2 object_id,
3 object_name,
4 cast(
5 multiset( select * from table(GetSomeFoo(object_id)) ) as TFooSet
6 ) as FOO
7 from all_objects
8 where owner = 'SYS'
9 and rownum <= 5;
OBJECT_ID OBJECT_NAME FOO(ID, BAR)
27538 /1000e8d1_LinkedHashMapValueIt TFOOSET(TFOO(27538, ' 0000'), TFOO(27539, ' 0001')
, TFOO(27540, ' 0002'), TFOO(27541, ' 0003'), TFOO
(27542, ' 0004'))
28544 /1005bd30_LnkdConstant TFOOSET(TFOO(28544, ' 0000'), TFOO(28545, ' 0001')
, TFOO(28546, ' 0002'), TFOO(28547, ' 0003'), TFOO
(28548, ' 0004'))
11718 /10076b23_OraCustomDatumClosur TFOOSET(TFOO(11718, ' 0000'), TFOO(11719, ' 0001')
, TFOO(11720, ' 0002'), TFOO(11721, ' 0003'), TFOO
(11722, ' 0004'))
30094 /100c1606_StandardMidiFileRead TFOOSET(TFOO(30094, ' 0000'), TFOO(30095, ' 0001')
, TFOO(30096, ' 0002'), TFOO(30097, ' 0003'), TFOO
(30098, ' 0004'))
684122 /1023e902_OraCharsetUTFE TFOOSET(TFOO(684122, ' 0000'), TFOO(684123, ' 0001
'), TFOO(684124, ' 0002'), TFOO(684125, ' 0003'),
TFOO(684126, ' 0004'))
SQL>
SQL> with dataset as(
2 select
3 object_id,
4 object_name,
5 cast(
6 multiset( select * from table(GetSomeFoo(object_id)) ) as TFooSet
7 ) as FOO
8 from all_objects
9 where owner = 'SYS'
10 and rownum <= 5
11 )
12 select
13 d.object_id,
14 d.object_name,
15 f.id,
16 f.bar
17 from dataset d,
18 table(d.foo) f
19 /
OBJECT_ID OBJECT_NAME ID BAR
217 DUAL 217 0000
217 DUAL 218 0001
217 DUAL 219 0002
217 DUAL 220 0003
217 DUAL 221 0004
268 SYSTEM_PRIVILEGE_MAP 268 0000
268 SYSTEM_PRIVILEGE_MAP 269 0001
268 SYSTEM_PRIVILEGE_MAP 270 0002
268 SYSTEM_PRIVILEGE_MAP 271 0003
268 SYSTEM_PRIVILEGE_MAP 272 0004
271 TABLE_PRIVILEGE_MAP 271 0000
271 TABLE_PRIVILEGE_MAP 272 0001
271 TABLE_PRIVILEGE_MAP 273 0002
271 TABLE_PRIVILEGE_MAP 274 0003
271 TABLE_PRIVILEGE_MAP 275 0004
274 STMT_AUDIT_OPTION_MAP 274 0000
274 STMT_AUDIT_OPTION_MAP 275 0001
274 STMT_AUDIT_OPTION_MAP 276 0002
274 STMT_AUDIT_OPTION_MAP 277 0003
274 STMT_AUDIT_OPTION_MAP 278 0004
815 RE$NV_LIST 815 0000
815 RE$NV_LIST 816 0001
815 RE$NV_LIST 817 0002
815 RE$NV_LIST 818 0003
815 RE$NV_LIST 819 0004
25 rows selected.
SQL>
Similar Messages
-
Error-local collection types not allowed in SQL statements
TYPE WEEK_NUM_T IS VARRAY(10) OF VARCHAR2(10);
vc_weeknum WEEK_NUM_T;
SELECT DISTINCT to_char(y.week_number_in_year) BULK COLLECT INTO vc_weeknum
FROM DD_TMP x, TIME y
WHERE x.DATE_TM = y.ORACLE_DATE;
INSERT INTO TMP_HOLD
(SELECT *
FROM TMP
WHERE DATE_TM IN (SELECT * FROM TABLE(vc_weeknum));It seems like the TABLE() function don't work. What is the workaround?You haven't provided enough of your code to tell, but you are probably trying to use a pl/sql type instead of a sql type. Please see the reproduction of error, then correction below.
-- reprouction of error:
scott@ORA92> CREATE TABLE tmp_hold AS SELECT * FROM dept WHERE 1 = 2
2 /
Table created.
scott@ORA92> DECLARE
2 TYPE WEEK_NUM_T IS VARRAY(10) OF VARCHAR2(10);
3 vc_weeknum WEEK_NUM_T;
4 BEGIN
5 SELECT DISTINCT deptno
6 BULK COLLECT INTO vc_weeknum
7 FROM emp;
8
9 INSERT INTO TMP_HOLD
10 SELECT *
11 FROM dept
12 WHERE deptno IN
13 (SELECT * FROM TABLE(vc_weeknum));
14 END;
15 /
(SELECT * FROM TABLE(vc_weeknum));
ERROR at line 13:
ORA-06550: line 13, column 31:
PLS-00642: local collection types not allowed in SQL statements
ORA-06550: line 13, column 25:
PL/SQL: ORA-22905: cannot access rows from a non-nested table item
ORA-06550: line 9, column 3:
PL/SQL: SQL Statement ignored
-- correction:
scott@ORA92> CREATE OR REPLACE TYPE WEEK_NUM_T AS TABLE OF VARCHAR2(10);
2 /
Type created.
scott@ORA92> DECLARE
2 vc_weeknum WEEK_NUM_T;
3 BEGIN
4 SELECT DISTINCT deptno
5 BULK COLLECT INTO vc_weeknum
6 FROM emp;
7
8 INSERT INTO TMP_HOLD
9 SELECT *
10 FROM dept
11 WHERE deptno IN
12 (SELECT * FROM TABLE (CAST (vc_weeknum AS week_num_t)));
13 END;
14 /
PL/SQL procedure successfully completed.
scott@ORA92> SELECT * FROM tmp_hold
2 /
DEPTNO DNAME LOC
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
scott@ORA92> -
Call C function in SQL statement
dear all
I want to know how i can call C function in SQL statement where clausehttp://asktom.oracle.com/pls/ask/f?p=4950:8:80100593788949622::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:934029542973
-
Problem in Calling a function in sql statement.
hi,
I am having a function ops_safex_utl.EDIT_ASSC_CNTR_LOG(id number);
when i am trying to use this inside a sql statement as shown below, it is giving error (exception part inside the function).
SQL> select ops_safex_utl.EDIT_ASSC_CNTR_LOG(688) from dual;
OPS_SAFEX_UTL.EDIT_ASSC_CNTR_LOG(688)
-1 (-- exception )
when i am trying to call this function using a PL/SQL Block then it is woking fine as shown below.
SQL> DECLARE
2
3 x NUMBER(2);
4
5 BEGIN
6
7 x := ops_safex_utl.EDIT_ASSC_CNTR_LOG(688);
8
9 dbms_output.put_line('x '||' '||x);
10
11 END;
12 /
hi
insert into ops_assc_cntr_log
insert into ops_ac_ex_gratia_log
insert into ops_ac_sls_dlvry_slab_dtls_log
insert into ops_ac_sls_dlvry_slab_dtls_log
insert into ops_ac_sls_dlvry_slab_dtls_log
insert into ops_ac_sls_dlvry_slab_dtls_log
insert into ops_ac_sls_dlvry_slab_dtls_log
insert into ops_ac_spl_acct_dtls_log
insert into ops_ac_spl_acct_slab_dtls_log
insert into ops_ac_spl_acct_slab_dtls_log
insert into ops_ac_spl_acct_slab_dtls_log
insert into ops_ac_spl_acct_dtls_log
insert into ops_ac_spl_acct_slab_dtls_log
insert into ops_ac_spl_acct_slab_dtls_log
insert into ops_ac_spl_acct_slab_dtls_log
update ops_assc_cntr
success
x 0
PL/SQL procedure successfully completed.
when i am trying to run the SQL statement it is returning a exception from the function.
SELECT ops_safex_utl.EDIT_ASSC_CNTR_LOG(688) from dual --it is returning -1 (i.e exception).
My sql client version is 9.2.0.1.0. and my data base version is 10.2.0.2.0.
Please advice.Could you post the exception handler within the function.
It sounds like you return -1 if you experience an error - it would be easier to determine the cause of the problem if you return the Oracle error details, E.g:
EXCEPTION
WHEN OTHERS THEN
RETURN dbms_utility.format_error_backtrace;This will then return a meaningful error, identifying exactly what is causing the error to be generated. -
Using cursor function in sql statement
hi all
can anyone plss explain why and when we will use cursor function in a sql statement like this and what is the difference while executing this sql statement with cursor function in comparison of a simple sql statement----
select
department_name,
cursor (
select last_name
from employees e
where e.department_id = d.department_id
order by last_name
) the_employees
from departments d
thnx in advanceRTFM
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/sqloperations.htm#sthref1452
Cheers
Sarma. -
How to retreive out parameters from function in sql statement
hi dear,
Suppose i have a fuction with two "out" parameters, i want to show the values of these paramenters in sql stm.
like
select my_function() from dual;
ThanxCan't be done. To use a function in SQL it can only have a single return value.
Try something like this changing the data types appropriately.
var x number
var y number
var z number
exec :x := my_function(:y, :z)
print -
PLS-00642: local collection types not allowed in SQL statements
Hi,
I want to retrieve empno in plsql table.
Now based on the empno in plsql table I want to retrieve thier deptno in another plsql table/varray.
SQL> declare
2 type vdeptno is table of number;
3 v_deptno vdeptno;
4 TYPE e_tab is table of PLS_INTEGER INDEX BY PLS_INTEGER;
5 empno_tab e_tab;
6 Begin
7 Select empno bulk collect into empno_tab FROM emp;
8 FOR i in empno_tab.FIRST..empno_tab.LAST
9 LOOP
10 dbms_output.put_line(empno_tab(i));
11 Select deptno into v_deptno
12 FROM emp
13 where empno=empno_tab(i);
14 END loop;
15 END;
16 /
Select deptno into v_deptno
ERROR at line 11:
ORA-06550: line 11, column 21:
PLS-00642: local collection types not allowed in SQL statementsAny other way to do the same.
TwinkleWhen you use this method ...
type vdeptno is table of number;
v_deptno vdeptno;
You need to allocate space to the object prior to inserting into it , (use .EXTENDS for this). Or you need to initialize it while declaring it.
or try the following
SQL> declare
2 type vdeptno is table of number;
3 v_deptno vdeptno;
4 TYPE e_tab is table of PLS_INTEGER INDEX BY PLS_INTEGER;
5 empno_tab e_tab;
6 Begin
7 Select empno bulk collect into empno_tab FROM emp;
8 FOR i in empno_tab.FIRST..empno_tab.LAST
9 LOOP
10 dbms_output.put_line(empno_tab(i));
11 Select deptno bulk collect into v_deptno
12 FROM emp
13 where empno=empno_tab(i);
14 END loop;
15 END;
16 /
Edited by: user9276238 on Jun 14, 2010 3:26 AM -
Using Column Name returned by function in SELECT statement
Hi
Output from my function (RETURN data type is VARCHAR2) is column name. I want to use it directly in my SELECT statement. Below is simplified example of this:
--- Function
CREATE OR REPLACE FUNCTION simple RETURN varchar2 IS
BEGIN
RETURN ‘my_column’;
END simple;
--- Select
SELECT simple FROM my_table;
This does not work. It seems that output from function is passed in quotation i.e.
SELECT ‘my_column’ FROM my_table;
So the output from SELECT is a list of rows populated with values my_table:
COLUMN simple
ROW1 my_column
ROW2 my_column
ROW3 my_column
Can please someone help me with this?I'm not sure I got you right.
In standard SQL everything must be known at compile time. If not dynamic SQL is required, but is a costly operation (usually requires parsing before each execution) so it should better not be used when standard SQL can do it.
I provided a design time example where a function returns the column name from the given the table name and column id for a varchar2 column data type to make things simple. Then a query string is constructed and executed dynymically to return all column values of the chosen table_name.column_name.
SELECT simple FROM my_tableAt compile time the simple function return value is unknown (any varchar2 value would do) you already find out you get the (same) return value (i.e column name) for each table row => dynamic SQL needed to get the column values
The purpose of function would be to rename all columns for provided table.The table name would be provided, right? If yes => dynamic SQL
What is the function supposed to return the column name (where would the new name come from?), the column alias (which table column would be renamed to the new name?)
The user could use the new_column name as the column alias name submitting the query.
Is it possible to do this?Maybe () using a pipelined function (different data types - number,date, ... not cosidered yet) but your simple query;
<tt>SELECT simple FROM my_table</tt>
might look like:
<tt>select my_column_value new_column_name from table(get_column_value(table_name,column_name))</tt>
Sorry, no Database at hand to provide a specific example.
Regards
Etbin -
Output of value returned from function in SELECT statement ??
Hi
I have created the below function
create or replace
FUNCTION jc_test
RETURN VARCHAR2
IS myrec VARCHAR2(270);
BEGIN
SELECT RPAD('*',270,'*')
INTO myrec
FROM DUAL ;
RETURN myrec;
END ;
and I executed the SELECT statement in Oracle SQL developer as a script
select
LENGTH(jc_test()) len
*,jc_test() rec*
from dual ;
I get exact output as below
LEN REC
270 ******************************************************************************************************************************************************************************************************************************************************************************
So here LEN is correctly shown as 270 characters but when I see the astrisk's (also appended with spaces ) its total length is 4000 characters
Can anyone give their thoughts on this.
Its fine if I run as normal, i mean not as a script.
Regards
jc
Edited by: JC on Jun 16, 2011 11:25 AMHi,
So here LEN is correctly shown as 270 charactersYes, correct
but when I see the astrisk's (also appended with spaces ) its total length is 4000 charactersNo buts. It is not padded. That is just how it is displayed by your tool. In SQL*Plus this is controlled by LINESIZE and COLUMN
SQL> create or replace function dummy return varchar2 as begin return null; end;
2 /
Function created.
SQL> select dummy from dual;
D
X
SQL> select dummy() from dual;
DUMMY()
SQL> col "dummy()" for a10
SQL> select dummy() from dual;
DUMMY()
SQL>P.S: It is a really bad idea to create your own wrapper functions, built-in functions. Hopefully you are not really doing that?
Regards
Peter -
Unable to call a Packaged function in SQL statement??
I have written a package & overloaded a function 3 times. I am using different parameter name for overloading & call as follows:
my_pkg.ovrld_func(p_1 => v_val)
my_pkg.ovrld_func(p_2 => v_val)
my_pkg.ovrld_func(p_3 => v_val)
When i use this statement in a sql or DML statement i get the following error.
ORA-00907: missing right parenthesis
I searched for limitations on packages but couldn't find this issue.
FYI: I am using Oracle 9i Rel2
ThanksI think its a bug as Oracle didn't report this limitation anywhere in the documentation & i should open a TAR.Well, it's documented limitation in fact.
Quote "Oracle9i Application Developer’s Guide - Fundamentals Release 2 (9.2)"
In a chapter entitled "Syntax for SQL Calling a PL/SQL Function"
p. 9-53.
Arguments
To pass any number of arguments to a function, supply the arguments within the
parentheses. You must use positional notation; named notation is not currently
supported. For functions that do not accept arguments, use ().Regards. -
How to write the sql statement of my finder function in cmp?
hi,
I create a cmp ejb from table INFOCOLUMN,and I create a my finder function ,which sql statement is :
select * from INFOCOLUMN WHERE employee_id=id
employee_id is a column of the table,and id is the finder function parameter.
The error is : invalid column name
So,how to write the sql statement.
Thanks .Mole-
Bind variables are of the form $1, $2, etc., so your query stmt should look like:
select * from INFOCOLUMN WHERE employee_id=$1
-Jon -
Using Procedure in SQL statement
Dear Sir,
As you know, I can use any function in SQL statement. For example:
SELECT systimestamp,
Function_Name(variable1, variable2,...)
FROM anytable;
So the previous function could only retrieve one value -as functions concepts-. Anyhow, Can I, in someway, use Procedure that take multiple in parameters and return multiple out parameters in SQL statement.
Thank you in advance.Sir,
I got a way in order to use the benefit of procedure in function. It's trough your idea in using TYPE OBJECT as the following:
===================================================================
create or replace type Missed_Txn_type AS OBJECT
(Txn_Timestamp_obj timestamp,
Txn_Type_Obj Number(12));
===================================================================
Then I created function and used this type as returned value:
FUNCTION Get_Shift_Missed_Txn_Obj(F_Date_In Date,
F_Time_In Timestamp,
F_Employee_Id number)
RETURN Missed_Txn_type;
The issue is: I want send the variables of the function through SELECT statement which they come from another table like:
SELECT
EMP.ID,
sd.date_value,
shf.Time_In,
T.OBJ.Txn_Timestamp_obj,
T.OBJ.Txn_Type_Obj
FROM
EMPLOYEE EMP,
Stored_Date SD,
Shifts shf,
(select Get_Shift_Missed_Txn_Obj(sd.date_value,
shf.time_in,
EMP.Id) OBJ from dual) T
WHERE
[where clause]
But the previous statement returned an error shows that it couldn't determine the (EMP.ID, shf.time_in, sd.date_value...)...
And the same if I use it in the select list!
So sir, there is any way in order to solve this issue?
Thank you in advance. -
I use function in SQL statement. It is a dynamicaly build SQL, therefore I need overload functions. These funcs defined in package. The package has PRAGMA Restrict_References (.., WNDS). So all functions should be restricted to update database.
But Oracle returns an error:
Function NVL_ does not guarantee not to update database
This is my build SQL:
----- the execution string is: ---------------
Begin
INSERT INTO TEST_TBL_BS (MILL_ORDER, CLM1, CLM2, CLM3, NOTES, INIT_DATE )
VALUES (NV.NVL_(Arc_Utl.TEST_TBL_dltd.MILL_ORDER),
NV.NVL_(Arc_Utl.TEST_TBL_dltd.CLM1),
NV.NVL_(Arc_Utl.TEST_TBL_dltd.CLM2),
NV.NVL_(Arc_Utl.TEST_TBL_dltd.CLM3),
NV.NVL_(Arc_Utl.TEST_TBL_dltd.NOTES),
Arch.Init_Time );
End;
This is NV package:
PACKAGE NV IS
PRAGMA Restrict_References ( NV, WNDS );
NULL_date DATE := TO_DATE ('01/01/1001', 'mm/dd/yyyy');
NULL_numb NUMBER := 0;
NULL_str VARCHAR2 (10)
:= '?';
-- overloaded NULL_Val function returns NULL_<type> value (defined early)
-- depend on received variable type
FUNCTION NULL_Val ( val_in IN DATE )
RETURN DATE ;
FUNCTION NULL_Val ( val_in IN NUMBER )
RETURN NUMBER ;
FUNCTION NULL_Val ( val_in IN VARCHAR2 )
RETURN VARCHAR2 ;
-- PRAGMA Restrict_References ( NULL_Val, WNDS ); -- can be used in SQLs
-- these pretends to cover hole of the SYS.NVL that do not have posibility
-- to return default NULL value for every given type
FUNCTION NVL_ ( val_in IN DATE )
RETURN DATE ;
FUNCTION NVL_ ( val_in IN NUMBER )
RETURN NUMBER ;
FUNCTION NVL_ ( val_in IN VARCHAR2 )
RETURN VARCHAR2 ;
-- PRAGMA Restrict_References ( NVL_, WNDS ); -- can be used in SQLs
END NV;
CREATE OR REPLACE PACKAGE BODY NV AS
-- NULL_Val set of overloaded functions - returns appropriate NULL value
FUNCTION NULL_Val ( val_in IN DATE )
RETURN DATE IS
BEGIN RETURN NULL_date;
END NULL_Val; -- for date
FUNCTION NULL_Val ( val_in IN NUMBER )
RETURN NUMBER IS
BEGIN RETURN NULL_numb;
END NULL_Val; -- for NUMBER
FUNCTION NULL_Val ( val_in IN VARCHAR2 )
RETURN VARCHAR2 IS
BEGIN RETURN NULL_str;
END NULL_Val; -- for VARCHAR2
-- set NVL_ function to return default NULL value if received variable
-- is NULL or the received variable if it is not NULL
FUNCTION NVL_ ( val_in IN DATE )
RETURN DATE IS
BEGIN RETURN NVL( val_in, NULL_Val ( val_in )); END NVL_;
FUNCTION NVL_ ( val_in IN NUMBER )
RETURN NUMBER IS
BEGIN RETURN NVL( val_in, NULL_Val ( val_in )); END NVL_;
FUNCTION NVL_ ( val_in IN VARCHAR2 )
RETURN VARCHAR2 IS
BEGIN RETURN NVL( val_in, NULL_Val ( val_in )); END NVL_;
END NV;
Can anybody help : where is a problem and what I can do in my case?
I work in Oracle 7.3
Thank you,
AlexHi Alex,
I've found that on the RDBS docs:
If you specify DEFAULT instead of a function name, the pragma applies to all functions in the package spec or object type spec (including, in the latter case, the
system-defined constructor). You can still declare the pragma for individual functions. Such pragmas override the default pragma.
Try using that and let me know.
The docs says also that the declaration of the pragma for an overloaded function applies to the nearest one. You may also try to insert several declaration, one after every function declaration.
Bye Max -
Hi expert,
I have following sql statement, function 'hiroc_get_delta_amount1' and 'hiroc_get_delta_amount2' are separately used in select and where subclause. these two function are exactly same, except that there is a inserting log statement inside. for function 'hiroc_get_delta_amount1' , logs are supposed to write into log table1, whereas for function 'hiroc_get_delta_amount2' , logs are supposed to write into log table2. after running this sql, I got data loaded into log table2, however, there is no data loaded into log table1.
could you please tell me why there is no data in log table2 for function
1. sql statement;
select
pp.policy_premium_pk,
pp.policy_fk,
pp.policy_term_fk,
pp.risk_fk,
pp.coverage_fk,
pp.transaction_log_fk,
pp.coverage_component_code,
hiroc_rpt_user.hiroc_get_delta_amount1(pp.policy_fk, pp.policy_term_fk, pp.risk_fk, pp.coverage_fk, pp.transaction_log_fk, pp.coverage_component_code),
pp.rate_period_from_date
from PRODBKUPDW_MART.rmv_policy_premium pp
where pp.rate_period_type_code = 'TERM_COVG'
and pp.coverage_component_code 'NETPREM'
and hiroc_rpt_user.hiroc_get_delta_amount2(pp.policy_fk, pp.policy_term_fk, pp.risk_fk, pp.coverage_fk, pp.transaction_log_fk, pp.coverage_component_code) != 0
group by pp.policy_premium_pk,
pp.policy_premium_pk,
pp.policy_fk,
pp.policy_term_fk,
pp.risk_fk,
pp.coverage_fk,
pp.transaction_log_fk,
pp.coverage_component_code,
pp.rate_period_from_date;
2. log inserting statement used for both functions:
(1) function 'hiroc_get_delta_amount1'
insert into HIROC_RPT_USER.LOG_TEST1 values (v_start, sysdate,
p_policy_fk,p_policy_term_history_fk,p_risk_fk,p_coverage_fk,p_transaction_log_fk,p_comp_code);
COMMIT;
(2) function 'HIROC_GET_DELTA_AMOUNT_1'
insert into HIROC_RPT_USER.LOG_ZB_TEST_1 values (v_start, sysdate,
p_policy_fk,p_policy_term_history_fk,p_risk_fk,p_coverage_fk,p_transaction_log_fk,p_comp_code);
COMMIT;Are your functions using autonomous transactions?
We also need more information about the log tables etc. as we cannot tell what the problem would be from just that query, and no data. -
Question regarding an inline view or function inside SQL
Hi All,
I want to know whether using an inline view with in an sql query is better or a function call within the sql query is better.
When I check the explain plan in both the case I can see no difference in the cost.
Appreciate your valuable suggestions on this.
Thanks,
Maddy K.Hi, Maddy,
It depends. The answer to this kind of question is always "it depends" on several factors. It would help if you gave a specific example.
In general, a function is not an alternative to an in-line view. They're so different, that I suspect I don't really understand the question. Also, I don't understand why you're concerened with in-line views, and not with, for example, regular views or WITH clause sub-queries.
In general, calling user-defined functions from SQL statements is slow. If there's a simple way to get the same results without calling a user-defined function, then it will probably be faster not to call the function.
Don't pay much attention to the cost that explain plan gives it. It doesn't mean much to you.
Maybe you are looking for
-
JSF Problem invoking backing bean method
I want a backing bean method to be invoked when the submit button is clicked but for some strange reason the method is not getting invoked any Help in this regards would be great. I am able to properly get the values from database and display on the
-
Why a base class cannot be a Private or Protected ?????
why a base class cannot be a Private or Protected ?????
-
Hi, User is getting excessive workflow open items(emails) in his mailbox on weekends with message "You have received new work items". when he check there is no item to take action. How can I stop excessive workflow items? -Pankaj
-
Video files in gallery will not delete
I have 2 files in my "Camera Roll Gallery" that will not play, edit or delete. I cant find the file when I am browsing the files on my phone. It only shows up when I look in the photo Gallery, then in Camera Roll. Anyone know how i can get these to
-
Is adobe creative suite version1 compatible with windows 7
is adobe creative suite version1 compatible with windows 7