Pass a rowtype to a function in sql
Hi all,
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
Can you please tell me if the following is possible:
I have a function that takes a rowtype as one of the parameters and returns a varchar2
function test( pa_text in varchar2,
pa_emp in employee%rowtype
) return varchar2I had hoped I could use this function in a implicit cursor, something like
begin
for c in ( select d.deptno
, test(d.deptno, e.*) test
from emp e
, dept d
where e.deptno = d.deptno )
loop
end loop;
end;But this results in
Error: PL/SQL: ORA-01747: invalid user.table.column, table.column, or column specificationIs something like this even possible?
Thanks!
Rob
What you could do:
declare
v_deptno dept.deptno%type;
v_dcur sys_refcursor;
v_ecur sys_refcursor;
v_emp emp%rowtype;
begin
open v_dcur for select d.deptno,
cursor(
select e.*
from emp e
where e.deptno = d.deptno
) e
from dept d;
loop
fetch v_dcur
into v_deptno,
v_ecur;
exit when v_dcur%notfound;
loop
fetch v_ecur
into v_emp;
exit when v_ecur%notfound;
test(v_deptno,v_emp);
end loop;
close v_ecur;
end loop;
close v_dcur;
end;
/For example:
SQL> create or replace
2 function test(
3 pa_text in varchar2,
4 pa_emp in emp%rowtype
5 )
6 return varchar2
7 is
8 begin
9 return 'DEPTNO = ' || pa_text || ' ENAME = ' || pa_emp.ename;
10 end;
11 /
Function created.
SQL> set serveroutput on
SQL> declare
2 v_deptno dept.deptno%type;
3 v_dcur sys_refcursor;
4 v_ecur sys_refcursor;
5 v_emp emp%rowtype;
6 begin
7 open v_dcur for select d.deptno,
8 cursor(
9 select e.*
10 from emp e
11 where e.deptno = d.deptno
12 ) e
13 from dept d;
14 loop
15 fetch v_dcur
16 into v_deptno,
17 v_ecur;
18 exit when v_dcur%notfound;
19 loop
20 fetch v_ecur
21 into v_emp;
22 exit when v_ecur%notfound;
23 dbms_output.put_line(test(v_deptno,v_emp));
24 end loop;
25 close v_ecur;
26 end loop;
27 close v_dcur;
28 end;
29 /
DEPTNO = 10 ENAME = CLARK
DEPTNO = 10 ENAME = KING
DEPTNO = 10 ENAME = MILLER
DEPTNO = 20 ENAME = SMITH
DEPTNO = 20 ENAME = JONES
DEPTNO = 20 ENAME = SCOTT
DEPTNO = 20 ENAME = ADAMS
DEPTNO = 20 ENAME = FORD
DEPTNO = 30 ENAME = ALLEN
DEPTNO = 30 ENAME = WARD
DEPTNO = 30 ENAME = MARTIN
DEPTNO = 30 ENAME = BLAKE
DEPTNO = 30 ENAME = TURNER
DEPTNO = 30 ENAME = JAMES
PL/SQL procedure successfully completed.
SQL> SY.
Similar Messages
-
How to pass table type variable into function from SQL*PLUS ?
How to pass a table type variable from sql*plus prompt into a function ?
Thanx in advance.Krishna,
Do you mean like this?SQL> DECLARE
2 TYPE t_tbl IS TABLE OF VARCHAR2(20);
3 l_sample_tbl t_tbl;
4
5 FUNCTION print_contents ( p_tbl IN t_tbl )
6 RETURN VARCHAR2
7 IS
8 l_string VARCHAR2(1000);
9 BEGIN
10 FOR i IN 1..p_tbl.COUNT LOOP
11 IF (i = 1) THEN
12 l_string := p_tbl(i);
13 ELSE
14 l_string := l_string || ', ' || p_tbl(i);
15 END IF;
16 END LOOP;
17 RETURN (l_string);
18 END print_contents;
19
20 BEGIN
21 l_sample_tbl := t_tbl();
22 l_sample_tbl.EXTEND;
23 l_sample_tbl(1) := 'one';
24 l_sample_tbl.EXTEND;
25 l_sample_tbl(2) := 'two';
26 l_sample_tbl.EXTEND;
27 l_sample_tbl(3) := 'three';
28 l_sample_tbl.EXTEND;
29 l_sample_tbl(4) := 'four';
30 l_sample_tbl.EXTEND;
31 l_sample_tbl(5) := 'five';
32 DBMS_OUTPUT.PUT_LINE(print_contents(l_sample_tbl));
33 END;
34 /
one, two, three, four, five
PL/SQL procedure successfully completed.
SQL> HTH,
T. -
Pass table rowtype between java class and PL/SQL package
I am a complete newbie when it comes to java itself but I've been asked to investigate the possibility of passing a rowtype datatype from a PL/SQL package to a java class and vice versa.
I have heard of oracle.sql.ArrayDescriptor as an option but this appears to address only SQL types that are defined outside of a package.
I'm talking about using, say, SCOTT.EMP%rowtype instead of a user-defined type. I'm thinking that a java array could be defined from the definition of a table in the database but I don't know what class would be appropriate.
Could someone provide a simple proof-of-concept example that shows how you could use a java array to pass data to a package that is expecting a table rowtype variable and conversely a java class that reads the rowtype returned into a java array?
Would oracle.jdbc.driver.OracleDatabaseMetaData be a way of doing this?
Thanks!Kuassi:
<br><br>
Not at all. I didn't feel like you misled me at all. I'm grateful for your help. I think that maybe I failed to describe my problem adequately in the first place.
<br><br>
Perhaps I've also gotten stuck on the term <i>ref cursor</i>.
<br><br> At any rate, the people I'm gathering information for have further refined their requirement. We want to take a collection of data and send it to a procedure. It doesn't have to be a "ref cursor" or "%rowtype" per se, but something that is maintainable and workable from both ends.
<br><br>
For example, to use the old SCOTT/TIGER paradigm, let's suppose we have a website where you can indicate which employees work for a given department. The website allows us to fill in information for multiple employees at once. We want to use a servlet that gathers all the employees data and sends it on through to a PL/SQL package so that the data is validated and committed in the database.<br><br>
Perhaps the java servlet should handle the multiple employee records as an array? If so, how can a PL/SQL procedure be made to recognize that construct?<br><br>
I can accept that java cannot create a "ref cursor" type to send information to a package, but might this be possible via some other implementation?
<br><br>
Hopefully this is a little more clear. If not, please let me know and I'll try to inject more details as to what we are trying to accomplish.
<br><br>
Once again, thanks for your persistent replies and help.
<br> -
Passing parameters from java jdbc to pl/sql
I’m calling stored procedures from java jdbc… but looking for nicer interfaces in terms of passing data. Has anyone come up with a good way to pass data from java jdbc to pl/sql without passing a million parameters? I’m thinking here of some type of structure like pl/sql rowtype or table index type or something else. Has anyone tried to create typed objects in oracle databases and access them from java?
Thanks, Patrick CaldwellHi Patrick,
Yes, I have created an Oracle object type, which I successfully returned to a java class, from a PL/SQL stored function, using JDBC. Environment was J2SE 1.3.1, with Oracle 8.1.7.4 on SUN [sparc] Solaris 7 with Oracle's JDBC (thin) driver. It was a while ago, so I don't remember the details very clearly, but I recall being able to figure it out quite easily using the Oracle documentation and the sample code available at Oracle's Technet Web site.
Hope this has helped you.
Good Luck,
Avi. -
I don't know if I should be posting this in this Forum or the BI Publisher forum, so I am posting in BOTH forums..
I love APEX, let me say that first.. And appreciate the support offered here by the group, but am running int a confusing issue when BI Publisher tries to build a report from the above type APEX report..
Here is my dilemma:
I have a number of reports that are part of a Oracle package. They return an SQL Query back to a reports region on a page. I am having to deal with the column names returned are col01, col02..
The issue I have is, when building the Application Level query to download the XML sample from in building RTF layouts in Word, you can not use this code, you MUST use a standard SQL Select.
I have taken the sql from the function returning sql, and copied into the application query, supplying the required data values for bind variables being used in the query.
An XML file is produced, and I use this to build the RTF format file that I load back into APEX and try to use it for the PDF rendering of the report. I can view the output as a PDF in the Word add on, but when I try using it with the report, it is returning an empty PDF file.
Can anyone tell me what error log files on the bi publisher side I can look at to see what error is happening?
Thank you,
Tony Miller
UTMB/EHN
Title changed, maybe SOMEONE has an idea on this??
Message was edited by:
Tony MillerHi,
1/ first check you are passing the bind variables and
appropriate values in the call to your report - if
the query returns no data then you get an empty page
So if your query takes :P10_USERNAME variable then
pass it to the report in the URL
f?p=&APP_ID.:0:&SESSION.:PRINT_REPORT=YOUR_REP_QUERY_N
AME:::P10_USERNAME:MYUSER
2/ try to use the Default layout first to check your
report query really returns the data when called
3/ if you defined a header in your rtf template check
there is no & (ampersand) - if using & in the header
and preview the template from word it displays data
OK, but if you use this template in the report query
it fails to render the data (bug in Apex-> Bi
Publisher integration maybe?)
4/ If using the table in the rtf template check its
width does not overflow the page margins - there is a
problem with pdf export
5/ check
/oc4j/j2ee/home/application-deployments/xmlpserver/app
lication.log forthe information on BI Publisher runs
RadoIssue was in the APEX page having issues.. I recoded a new page and am able to generate BI Publisher based PDF files..
Thank you,
Tony Miller
UTMB/EHN -
How to create a dynamic multi-line function in SQL Server
I am attempting to create a Multi-Line Function in SQL Server that accepts a dynamic WHERE clause as a parameter. I need this so that the function can be as versatile as possible for the filter that needs to be applied. I am unfortunately getting an error
upon creation of the function. I don't know how to solve the problem. Can someone advise me?
SQL:
SET
ANSI_NULLSON
GO
SET
QUOTED_IDENTIFIERON
GO
-- =============================================
-- Author:
-- Create date: 2/3/2014
-- Description: This multiline function will accept a generic WHERE Clause and apply it to the query for return.
-- =============================================
CREATE
FUNCTIONTESTMULTILINEFUNCTION
@WHEREvarchar(1024)
,@CHANGEDDATEasdatetime
RETURNS
@TESTTABLE
TABLE
IDint
,REVint
AS
BEGIN
Declare@SQLSTRINGvarchar(4096)
SET@SQLSTRING=''
SET@SQLSTRING=@SQLSTRING+'SELECT
REVS.ID, REVS.Revision
FROM
Select distinct result.ID, Max(Rev) as ''''Revision''''
FROM
Select * from dbo.BugsAll
where
[Changed Date] < @CHANGEDDATE
) result
GROUP BY result.ID
) REVS
join dbo.BugsAll BA on (BA.ID=REVS.ID AND BA.REV=REVS.revision)'
IF
(@WHEREisnotnullOR@WHERE<>'')
BEGIN
SET@SQLSTRING=@SQLSTRING+'
WHERE '+@WHERE;
END
INSERT@TESTTABLE
EXEC
(@SQLSTRING)
RETURN
END
GO
ERROR:
Msg 443, Level 16, State 14, Procedure TESTMULTILINEFUNCTION, Line 44
Invalid use of a side-effecting operator 'INSERT EXEC' within a function.
Senior Test Lead -- Microsoft>> Unfortunately I really need to form a dynamic query in a table valued function on the SQL SERVER. I have another tabled valued function that needs something returned as a table in order to further join the data. I am not allowed to use Stored
Procedures in that function. <<
You do know that real SQL programmers hate the proprietary nightmare of tabled valued functions? This is how you procedural programmers avoid learning set-oriented declarative and functional programming.
Your mindset wants to write to a scratch tape or disk file (aka “tabled valued function result table”) just like you did BASIC, FORTRAN or COBOL. QL programmers do not have to materialize their data. We can use VIEW or a drive table as well as a base table.
>> Plus, there are occasions where I don't want to pass in a field [sic: columns are not fields] parameter or need to change a parameter list such that I don't wish the table function to filter by a particular field [sic] or other setting. <<
What you want is a magical “Automobiles, Squids and Lady Gaga” function. An SQL programmer might write a complex VIEW then do simpler SELECTs off it.
>> My application pushes the WHERE clause from EXCEL to SQL to do the hard work as EXCEL is not the application in which I want to process the SQL statement and pass it via ODBC. I cannot run macros in Excel on the web.<<
This is a crazy language system. Usually we fetch data in SQL and then pass it to a math package, report writer, etc. We never keep logic (aka WHERE clauses) outside the database.
>> I am bummed about the fact that this feature doesn't work. It will up my server management costs to maintain unique tabular based functions based on WHERE clause query <<
So stop writing those “tabular based functions”, change your mindset and start learning SQL and do it right.
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
ORA-00932 when trying to pass ARRAY from Java SP to PL/SQL
Hi all
I am trying to pass ARRAYs back and forth between PL/SQL and Java stored procedures. But I keep getting:
ORA-00932: inconsistent datatypes: expected a return value that is an instance of a user defined Java class convertible to an Oracle type got an object that could not be converted
Here's my PL/SQL:
create or replace type CONTENTP.sentences_array as VARRAY(1000) of CLOB
-- I've also tried .. as TABLE of CLOB and varray/table of VARCHAR2
declare
proc_clob CLOB;
arr SENTENCES_ARRAY;
begin
SELECT document_body
into proc_clob
from documents
where document_id = 618784;
arr := processdocument.sentencesplit (proc_clob);
end;
PROCESSDOCUMENT package definition:
CREATE OR REPLACE PACKAGE CONTENTP.PROCESSDOCUMENT AS
FUNCTION sentenceSplit(Param1 CLOB)
return SENTENCES_ARRAY
AS
LANGUAGE java
NAME 'com.contentp.documents.ProcessDocument.sentenceSplit(oracle.sql.CLOB) return oracle.sql.ARRAY';
FUNCTION removeHTML(Param1 CLOB)
return CLOB
AS
LANGUAGE java
NAME 'com.contentp.documents.ProcessDocument.removeHTML(oracle.sql.CLOB) return oracle.sql.CLOB';
end;
Java sentenceSplit code:
public static oracle.sql.ARRAY sentenceSplit ( CLOB text) throws IOException, SQLException
Connection conn = new OracleDriver().defaultConnection();
String[] arrSentences = sent.getsentences ( CLOBtoString (text) );
ArrayDescriptor arrayDesc =
ArrayDescriptor.createDescriptor ("SENTENCES_ARRAY", conn);
ARRAY ARRSentences = new ARRAY (arrayDesc, conn, arrSentences);
return ARRSentences;
I have confirmed that the String[] arrSentences contains a valid string array. So the problem seems to be the creation and passing of ARRSentences.
I have looked at pages and pages of documents and example code, and can't see anything wrong with my declaration of ARRSentences. I'm at a loss to explain what's wrong.
Thanks in advance - any help is much appreciated!I am trying to do something similar but seems like getting stuck at registerOutParameter for this.
Type definition:
CREATE OR REPLACE
type APL_CCAM9.VARCHARARRAY as table of VARCHAR2(100)
Java Stored Function code:
public static ARRAY fetchData (ARRAY originAreaCds, ARRAY serviceCds, ARRAY vvpcs) {
Connection connection = null;
ARRAY array = null;
try {
connection = new OracleDriver ().defaultConnection();
connection.setAutoCommit(false);
ArrayDescriptor adString = ArrayDescriptor.createDescriptor("VARCHARARRAY", connection);
String[] result = new String [2];
result[0] = "Foo";
result[1] = "Foo1";
array = new ARRAY (adString, connection, result);
connection.commit ();
return array;
} catch (SQLException sqlexp) {
try {
connection.rollback();
} catch (SQLException exp) {
return array;
Oracle Stored Function:
function FETCH_TRADE_DYN_DATA (AREA_CDS IN VARCHARARRAY, SERVICE_CDS IN VARCHARARRAY,VV_CDS IN VARCHARARRAY) return VARCHARARRAY AS LANGUAGE JAVA NAME 'com.apl.ccam.oracle.js.dalc.TDynAllocation.fetchData (oracle.sql.ARRAY, oracle.sql.ARRAY, oracle.sql.ARRAY) return oracle.sql.ARRAY';
Java Code calling Oracle Stored Procedure:
ocs = (OracleCallableStatement) oraconn.prepareCall(queryBuf.toString());
ArrayDescriptor adString = ArrayDescriptor.createDescriptor("VARCHARARRAY", oraconn);
String[] originAreaCds = sTDynAllocationVO.getGeogAreaCds();
ARRAY areaCdArray = new ARRAY (adString, oraconn, originAreaCds);
ocs.registerOutParameter(1, OracleTypes.ARRAY);
ocs.setArray (2, areaCdArray);
String[] serviceCds = sTDynAllocationVO.getServiceCds();
ARRAY serviceCdsArray = new ARRAY (adString, oraconn, serviceCds );
ocs.setArray (3, serviceCdsArray);
String[] vvpcs = sTDynAllocationVO.getVesselVoyagePortCdCallNbrs();
ARRAY vvpcsArray = new ARRAY (adString, oraconn, vvpcs);
ocs.setArray (4, vvpcsArray);
ocs.execute();
ARRAY results = ocs.getARRAY(1);
Error I get:
Parameter Type Conflict: sqlType=2003
Thanks for help in advance. -
Will calling functions in SQL reduce the performance of a query ?
yes it is a user defined function. The function is a simple one such as below. This is being called in different SQL with the input parameter passed having different values.
function getdesc(param in varchar2)
return varchar2
is
begin
select description
into empdesc
from emp
where codetype = param;
return empdesc;
end;
My question here is this could have been included in the SQL itself but for code maintenance/reusability the function is used. So which one do you suggest - to include in the SQL itself or to call a function ? -
How to pass an array to a function from a SELECT statement
Hi all. I have a problem with passing an array to a function directly from a SELECT statement.
Here is what I want. If I have a function
function AAA(arrayVar <ArrayType>) return number;
I want to be able to call this function this way
select AAA((2,3,4))
from dual
or this way
select AAA((10,12))
from dual
In other words I want to be able to pass an arbitrary number of numbers to the function. And I want this to work in a SELECT statement.
Does anyone have any ideas how to implement this? What <ArrayType> should I use?(I've read about VARRAY, nested tables in the Oracle documentation but as far as I've understood these array types are meant to be used within PL/SQL blocks).
I found only this http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:208012348074 through Google but it didn't help me.
Thank you in advance.> What <ArrayType> should I use?
SQL data types - as 3360 showed above. You cannot use PL/SQL structures and user types in the SQL Engine.
You can however use all SQL structures and types in PL/SQL.
Arrays in SQL is created as collection type - basic o-o. The collection type (or class) serve as a container for instantiated objects or scalar type.
This is covered in detail in [url http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14260/toc.htm]
Oracle® Database Application Developer's Guide - Object-Relational Features -
Need (procedure or function or sql query )for Email filter
Hi All,
in (procedure or function or sql query ) ,if i pass the a input parameter like (anbu@y or anbu@ or anbu@yahjjj ) ,i need to get output like [email protected] .
please give me code for this ...SQL> with t
2 as
3 (
4 select 'anbu@y' email from dual union all
5 select 'anbu@' from dual union all
6 select 'anbu@yahjjj' from dual
7 )
8 select email, regexp_replace(email, '@.*','@yahoo.com') email_new
9 from t
10 /
EMAIL
EMAIL_NEW
anbu@y
[email protected]
anbu@
[email protected]
anbu@yahjjj
[email protected] -
Want to convert function in SQL Server 2000
Hi ,
i am writing this function in oracle.Could you please convert this function in SQL Server 2000 because i am new in this and dont know how to use decode function in sql.
Please following is the code for oracle.
CREATE OR REPLACE function fun ( localex varchar2,titlex varchar2)
return number
as x number;
begin
select sum ( decode (count (username),max(prereq_count),1,0) ) x into x from
SELECT
prereq_count,
username
FROM
table1
group by username ;
return x;
end fun;
Regards
VishalJust take a look example below might give you idea :
create or replace function f_makeAddress_tx (
i_address_tx VARCHAR2,
i_city_tx VARCHAR2,
i_state_tx VARCHAR2,
i_zip_tx VARCHAR2)
return VARCHAR2
is
e_badZip EXCEPTION; u279E8
pragma EXCEPTION_init(e_badZip,-20998); u279E9
v_out_tx VARCHAR2(256);
begin
p_validateZip (i_zip_tx); u279E12
v_out_tx:= i_address_tx||u2019, u2018|| u279E13
i_city_tx ||u2019, u2018||
i_state_tx ||u2019, u2018||
i_zip_tx;
return v_out_tx; u279E17
exception
when e_badZip then u279E19
return i_zip_tx || u2018: Invalid zip code.u2019;
end;
Regards,
Clint -
Report- Pl/sql function returning sql query parsing page items as text?
Hi Team,
I am facing a strange issue .
I have four page items namely
1)JOB_CODE
2)MIN_EXP
3) MAX_EXP
4) SOURCES1
I have a report of the type "Pl/sql function returning sql query"
declare
v_sql varchar2(4000);
begin
if (:JOB_CODE IS NOT NULL and :MIN_EXP IS NOT NULL and :MAX_EXP IS NOT NULL and :SOURCES1 IS NOT NULL) then
v_sql:= 'select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where V_REQUIREMENT = :JOB_CODE and v_experience_years >= :MIN_EXP and v_experience_years <= :MAX_EXP and source like ' || '''' || '%'|| ':SOURCES1' || '%' || '''';
elsif (:JOB_CODE IS NULL and :MIN_EXP IS NOT NULL and :MAX_EXP IS NOT NULL and :SOURCES1 IS NOT NULL) then
v_sql := 'select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where v_experience_years >= :MIN_EXP and v_experience_years <= :MAX_EXP and source like ' || '''' || '%'|| ':SOURCES1' || '%' || '''';
elsif (:MIN_EXP IS NULL and :JOB_CODE IS NOT NULL and :MAX_EXP IS NOT NULL and :SOURCES1 IS NOT NULL) then
v_sql := 'select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where v_experience_years <= :MAX_EXP and V_REQUIREMENT = :JOB_CODE and source like ' || '''' || '%'|| ':SOURCES1' || '%' || '''';
elsif (:MAX_EXP is null and :JOB_CODE IS NOT NULL and :MIN_EXP IS NOT NULL and :SOURCES1 IS NOT NULL) then
v_sql := 'select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where V_REQUIREMENT = :JOB_CODE and v_experience_years >= :MIN_EXP and source like ' || '''' || '%'|| ':SOURCES1' || '%' || '''';
end if;
insert into query_list values (v_sql);
insert into debug values (:JOB_CODE , :MIN_EXP , :MAX_EXP , :SOURCES1);
return v_sql;
end;
Please not that I am insertin the query into a table called Query_list and the page item values into the table called Debug thru the pl/sql function which returns teh query.
Now I select the data from the debug tables.
select unique(query) from query_list;
select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where V_REQUIREMENT = :JOB_CODE and v_experience_years >= :MIN_EXP and v_experience_years <= :MAX_EXP and source like '%:SOURCES1%'
select * from debug;
JOBCODE MINEX MAXEX SOURCE
21 1 10 donkeyHire
And if I run the query in sql I get some records returned
select v_candidate_id, v_fname,v_current_employer,v_Experience_years from candidature where V_REQUIREMENT = 21 and v_experience_years >= 1 and v_experience_years <= and source like 'donkeyHire'
V_CANDIDATE_ID V_FNAME V_CURRENT_EMPLOYER V_EXPERIENCE_YEARS
2 Vengu Andale Tech 4
But the record does not show up in the report!
does this type of report parse page items as text?
Why is it so?
Waiting for an early reply.
Thanks,
venkatVenkat - You don't want to put ':SOURCES1' in quotes like that.
Scott -
Issue with running PL/SQL function returning Sql query
hi, I am trying to create a report region by using the option of PL/SQL function returning sql query.
I notice that it's very slow for the report region page to show up. In my PL/SQL function body, there are only 3 steps, first update all the 10 rows of varchar2 fields to null,then insert values to those fields, then select all from the table to show report results. It takes more than 5 minitues for the page to load up, how ever, if i run those steps in SQL*Plus, it only takes a couple of seconds to finish. Any suggestions?
Thanks,
ginaSergio, the codes are as followed,
Declare
q varchar2(32767); -- query
Begin
q := 'select "ID",'||
'"ENTRY NAME","TOTAL","#CM","%CM","#CA",'||
'"%CA", from Info_table';
update info_table
set "TOTAL" = '',
"#CM" = '',
"%CM" = '',
"#CA" ='',
"%CA"=''
where "ID"<=10;
// set all data in column Total to null,there is only 10 rows in the table
update info_Table set Total = vTotal,
"#CM" = vCM
(those variables hold user key-in Text filed value)
where ID = 1;
return q;
End; -
Passing a node to Xquery function
Hi All,
I have two functions in my xquery. I'm trying to pass a node from one function to another function to check if it exists and do some processing on the text that is present in that node (if exists).
declare function appendLines($node as element()) as xs:string {
if(fn:exists($node) and $node/text() ne "") then
fn:concat($node/text(),", ")
else (
appendLines($LINE_ITEM/ns0:STATXT)
Is the above call to that function is correct?
Thanks!!!declare function appendLines($node as node()*) as xs:string {
if(fn:exists($node)) then
if(fn:string-length(fn:normalize-space($node/text())) > 0) then (
fn:concat($node/text(), " ")
else (
else (
It worked with the above function. -
Passing request table to Jco function
Hello Experts,
We have one requirement where we need to pass the table data from the BLS to SAP Jco Function Module call. For example we are reading the material numbers from the oracle database and then we need to pass these material numbers to SAP Function Module as a table to read the further details from SAP for the given material numbers.
We wrote a custom function module in SAP which accepts the material number as table. Is it possible to pass the table request parameter to Function Module? If possible how can we do this? I tried to pass the XML document to Function Module table, but no luck.
Thanks
MohanMohan,
in the BLT, configure the JCO action to use you custom function. After pressing enter, MII reads the xml structure of the function (if the connection MII to SAP is working). In the further processing of the BLT, you can fill the RFC table which you can see in the link editor using your query results and the link editor types "AppendXML" or "AppendAfter".
The following thread might help: [RFC call with multiple input|http://forums.sdn.sap.com/click.jspa?searchID=34070350&messageID=8134561].
Michael
Maybe you are looking for
-
HOW CAN I PUT MOVIES FROM MY LAPTOP TO MY IPAD
HI, HOW CAN I PUT MOVIES FROM MY LAPTOP TO MY IPAD
-
I have a PC running windows 2000 and Java 1.4. I would like to create a package somewhere on my hard disk and have my utility classes saved in that package. I have tried to fiddle with Environment variables but to no avail. What is the correct proced
-
Hi All, I am an ABAPper and am new to the FI module; so need guidance from you experts. We are printing payment document and need the Gross Amount, Withholding Tax amount and the Net Amount on the payment document. This is required as per the country
-
Recover the Datafile without any backup
Hi, I am new in oracle database. I have created a new database. database is in no archivelog mode. last night one of my sysaux datafile is currepted. is there any method to repair my sysaux datafile. the database is in mount mode.how can i open my db
-
Drill through from Planning to FDM 11.1.2 Not working
Hi, I have FDM with Essbase adapter installed, version 11.1.2.0.0. And i have FDM application configured to load data from files to essbase. When in Planning form i am clicking 'drill through' icon on cell with loaded data it opens new window with er