SQL & PL/SQL :: Long Statement With Parameters - Too Many Arguments For Function
Sep 22, 2010
I have an issue with rather complicated function.Basically it is using DBMS_SQL to execute a very long statement with many parameters (~6000 of them) and binding them with DBMS_SQL.BIND_VARIABLE. Variables are called :1,:2,...,:6000.
When this arguments set is too large - I am receiving error "ORA-00939: too many arguments for function".
Currently I am thinking about dividing the query into subqueries and executing them all with performance decrease.
I would like to know if it is possible to get the arguments of a function (or procedure), in the same way as - for example - the "arguments" object in JavaScript.
I have seen the table ALL_ARGUMENTS, for example, that is providing a lot of interesting details, but I still miss the most important for me: the values of the arguments, not only the name, or type, etc...
Something that could be called as soon as the function (or procedure) is run, at the beginning of its process, and that would give a kind of array of arguments values.
I wrote function Quantity(p_item_number in varchar2)RETURN NUMBER, i called This function in POST_QUERY ,Error like this "wrong number or type of arguments in call to Quantity", i tried like as " Quantity(p_item_number in varchar2)RETURN NUMBER" , but it gives an error "encounterd the symbol VARCHAR2 when expecting one of the following ( "..
After Migrating from 11.1 to 11.2 SQL Statements are running for a long time. Our DBA told that they don't have any execution plans for the SQL Statements in 11.1
I don't want to rewrite the SQl Statement as this is working fine in 11.1. Our DBA conveyed us that they are using DBMS_STATS.AUTO_SAMPLE_SIZE for Schema Level.
But we have planned to generate DBMS_STATS.GATHER_TABLE_STATS Estimate Percentage ==> 100 for only the tables that are used in SQl Statements.
Of course we can change the parameters.. But we are afraid it may have some side effects.
I ran one long running update statement in my sqlplus session, where it took hours together since we have millions of rows on the table.lock the system and left the office , the next day I found my system is rebooted, hope the session would have performed the long running update statement.
Now, I need to issue a commit for the session, since my system is rebooted I don't have opened session with me. so, How to issue commit to the session, which I have issued long running update statement.
We are firing a normal Drop command on our database and the database version is 10.2.0.4.The database is running on AIX v5.The command is taking more time than usual .
When i am monitoring the session i can see that a call is being made to procedure "aw_drop_proc".Could i ask you if this is something that is taking more time than usual.
We are not having any partitions on the nested tables .We have a pack of tables and we are dropping this pack through a procedure.The pack comprises of nested tables & normal tables.To drop a nested table it is taking around 6 seconds(Table with no rows) and a normal table(With no rows) it is taking 17 milli seconds.We have a partition on Normal table.
The same operation in windows is taking very less time when compared to AIX.
I am trying to put transactions into 3 different "buckets" for each month of the year.
I am trying to figure out if the syntax for the "else" part of this code is correct... this will basically appear 12 times for each month of the year changing the value for month:
case when floor(sum(total_adjusted_net_amount)/100) < 0 and month in (01) then 0 when floor(sum(total_adjusted_net_amount)/100) > 29 and month in (01) and then 30 else when floor(sum(total_adjusted_net_amount)/100) and month in (01) end Groupin_01
I need to use funtion optional parameters to construct an update statement in the funtion body. I have two scenarios, either both parameters are not null or the 2nd is null. Do I have to use
IF (param2 is null) THEN udpate using param1 only ELSE update using both param1 and param2 END IF; or is there a shortcut to do this?
i have a function which takes in two variables and return a varchar.
ex: Function(var1,var2) return as varchar2.
in the function,i query a table for var1 and var2 and concatenate the result set to return a varchar. But if either var1 or var2 is null,then my query in the function fetches the result set for the other variable.
My question is,how would i pass a null value through the function and handle it in the function.
The function definition in PL/SQL has IN OUT parameter as well as return statement. Using both we can return the values. Basic definition of a function is function can return only one value at a time.
The question is, Can we return a number thru return statement and a char value thru INOUT parameter. Is it possible to return two different values using these?
I am currently studying a Foundation degree in computer software development, and one of my assignment in PL/SQL I am stuck on one of the tasks.
I have to create a procedure where one of the parameters needs to have a default value of one, if no value is entered when the procedure is called. I have trued to use the NVL function which worked when using a anonymous block, but now I have to convert that to a procedure. My problem is I'm getting an error.
The code for the procedure is
CREATE OR REPLACE PROCEDURE add_new_classes (p_number_of_classes NUMBER := NVL(NULL,1), -- This will enter a default value of 1 if the user does not specify a number p_course_id classes.course_id%TYPE, p_period classes.period%TYPE, p_frequency classes.frequency%TYPE,
[code]....
I then use this to test it
BEGIN add_new_classes(1002,'first','daily',3002); END;
and the error I get is
Quote:ORA-06550: line 2, column 4: PLS-00306: wrong number or types of arguments in call to 'ADD_NEW_CLASSES' ORA-06550: line 2, column 4: PL/SQL: Statement ignored 1. BEGIN 2. add_new_classes(1002,'first','daily',3002); 3. END;
I got an exception when I was using sesame adapter to dump a turtle file which contains long texts as objects into oracle semantic database. The exception information is:
org.openrdf.repository.RepositoryException: org.openrdf.sail.SailException: java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column
ORA-06512: in "SF.ORACLE_ORARDF_ADDHELPER", line 1 ORA-06512: in line 1 at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:439) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:395) at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:802) ...
resolve problem with move lob objects ? I move table partition and lob (BLOB) from one tablespace to another :
alter table EBIF.APO_T_VER_DISP_ACC_RESP MOVE PARTITION P1M20120901 LOB(SIGNATURE_PATTERN) STORE AS (TABLESPACE tmp) t able EBIF.APO_T_VER_DISP_ACC_RESP MOVE PARTITION have : pbeb_ap1.SYS>select partition_name , tablespace_name from dba_lob_partitions where table_name='APO_T_VER_DISP_ACC_RESP';
CREATE OR REPLACE FUNCTION is_overdue (due_date IN DATE,paid_date IN DATE) RETURN BOOLEAN IS days_between NUMBER (2) := due_date - paid_date; BEGIN [code]......
When i try using this compilation, i am getting error for this program:
SQL> begin 2 dbms_output.put_line(is_overdue('07-nov-1987','01-aug-2012')); 3 end; 4 / dbms_output.put_line(is_overdue('07-nov-1987','01-aug-2012')); * ERROR at line 2: ORA-06550: line 2, column 7: PLS-00306: wrong number or types of arguments in call to 'PUT_LINE' ORA-06550: line 2, column 7: PL/SQL: Statement ignored
To get output for this program? Show me how to compile.
When we create sql and some pieces of sql are implemented as oracle function. and we run this sql only once every day. I read article that function after first run located in cache. This part of cache ( with function ), is it really consume one oracle resources? Or it will be erased after while.
Can we call a function within decode statement. I am able to do the same for simple example function . But In my actual procedure it's giving the error message . Are there any restrictions to call function with in decode statement?
I am trying to use decode function in sql and inside decode function can I use select statement ?
here is my sql
select we.wf_entity_id, decode(object_type_id, 1, select audit_number from ea_audit_general where sys_audit_id=object_id 2,'test', object_type_id ) from wf_entity we where
[code]....
see this
decode(object_type_id, 1, select audit_number from ea_audit_general where sys_audit_id=object_id 2,'test', object_type_id )
I am trying to search a way to get the SQL statement that caused an exception withing an oracle function. I tried:
SELECT sql_text from v$session ses, v$sql sql where sql.sql_id = ses.prev_sql_id and ses.sid = sys_context('userenv','SID') AND ROWNUM = 1;
but this doesn't always return the last statement that the function has executed. if needed i can send the complete script for the function and its tables and stored procedures for testing.
I am getting a (PL/SQL: ORA-00903: invalid table name) compile error in a procedure using a merge statement. I have seen many examples using this technique and am at a loss as to why I can't compile.
the pipelined function is:
FUNCTION f_crcli_pipe(pi_source_data IN sys_refcursor, pi_limit_size IN PLS_INTEGER DEFAULT pkg_crcli_variables.c_cursor_limit_def) RETURN CRCLI_AA PIPELINED PARALLEL_ENABLE(PARTITION pi_source_data BY ANY) IS
[code].....
the error is pointing to the TABLE function in the USING clause of the merge statement.
In the below SQL, I am calling a function "listagg_nm(deptno)", and function is to get all the employee name for a particular department with comma separated
output is: ------------------------------------------------- DEPTNO SAL LISTAGG_NM(DEPTNO) 10 5000 KING,CLARK,MILLER 10 1300 KING,CLARK,MILLER 10 2450 KING,CLARK,MILLER 20 2975 JONES,SCOTT,FORD,SMITH,ADAMS
[code]....
below are the code
select deptno,sal,listagg_nm(deptno) from emp order by deptno; FUNCTION listagg_nm (p_deptno NUMBER) RETURN CLOB IS v_str CLOB;
[code]....
My doubt/question is for every row in the SQL the function is being called. t means that for 1st row deptno=10, the function is called and return all concatenated name for department 10, then again for 2nd row deptno=10, it again do the same, similarly for all other department.
Can we avoid this, I mean, if function is already returned a concatenated string of ename for deptno=10, then in the next function call it will checks if it is for same department (i.e. deptno=10) then the function will not go into for loop and it will directly return the concatenated string of ename for deptno=10 which we already done for the first row and so on for other department number ( something like storing the value in variable. Is it possible to achive this and does this is good for performance as we are not going into loop inside the function to return the concatenated string of ename for the same deptno everytime ( I have to return more than 10000 char., so i used clob in function and similarly the numbers of row return by SQL is more than 1000)and also how to code this, I tried but unable to achive.
WHILE EXISTS ( SELECT * FROM tblOrgChart WHERE fxOrgID = v_chrTempKeyDept ) LOOP v_intDept := CAST(v_chrTempKeyDept AS NUMBER) + 1 ; v_chrTempKeyDept := LPAD('',3 - LENGTH(CAST(v_intDept AS VARCHAR2)),'0') || CAST(v_intDept AS VARCHAR2) ; END LOOP;
Error: PLS-00204: function or pseudo-column 'EXISTS' may be used inside a SQL statement only
How to call a function with a row type return in an Oracle select statement.
For e.g. :
If I had this function with a rowtype return: ------------------------------ create function abc return xyz%rowtype is rec xyz%rowtype; begin select * into rec from xyz where col1 = n; return rec; end; -------------------------------- How could I use this in a select clause, as there is a multi column return by the function ?