How to do UT for pl/sql code?
Are there some tools for doing Unit Test for PL/SQL code?
Are there any others tools,except the function of test in pl/sql developer?
I have defined a package named pkg_utplsql_test with 1 function called btwnstr (taken from utplsql samples).
This package/function exists in schema1@instance1.
Now I have schema2@instance2. Here I have defiend my test package called ut_pkg_utplsql_test and this has the setup and tear down
procs as follows:
procedure ut_setup
is
begin
null;
end;
procedure ut_teardown
is
begin
null;
end;Now I need to add ut_btwnstr to test the proc defined in schema1@instance1. I have defined a dblink named instance1 to
access the package from instance2. I am confused about writing ut_btwnstr . Here is what I have done and it does compile.
PROCEDURE ut_btwnstr IS
BEGIN
utAssert.eq (
'Typical valid usage',
pkg_utplsql_test.btwnstr@instance1(STRING_IN => 'abcdefg',START_IN => 3,END_IN => 5),'cde');
end ut_btwnstr; Is this correct?
And now when I need to test it, how do I call. I am confised:(.
exec utplsql.test('pkg_utplsql_test.btwnstr@instance1',recompile_in => FALSE)
Similar Messages
-
How to trigger updateMarker for TextEditor from code
I'm making my own marker. But when I change document programmatically, I couldn't trigger updateMarker. So markers're indexs don't change.Markers has not showed correctly. How to trigger updateMarker for TextEditor from code?
Hi Viren,
Glad that your problem is resolved.
Help.Sap.com is the best reference: http://help.sap.com/saphelp_nw04/helpdata/en/b2/e50138fede083de10000009b38f8cf/frameset.htm
Also check the "How-To" docs in https://www.sdn.sap.com/irj/sdn/developerareas/bi
Bye
Dinesh -
How to add a custom PL/SQL code for a button event handler
Hi All,
I am a toddler in using Oracle Portal. So please forgive me for my ignorance.
Q : How do I add a custom PL/SQL code for a button event handler?
Basically, I would like to write MY PL/SQL function and call it. I could see that we can write "CUSTOM" code as "PL/SQL button event handler" in the form design window. But the question is that it expects only a "call" to procedure. But where do I define the procedure then? If I insert the procedure from the backend, it gets flushed the next time I compile my form.
Hope I am able to explain my point.
Thanks in advance,
Abbas.Hi All,
I am a toddler in using Oracle Portal. So please forgive me for my ignorance.
Q : How do I add a custom PL/SQL code for a button event handler?
Basically, I would like to write MY PL/SQL function and call it. I could see that we can write "CUSTOM" code as "PL/SQL button event handler" in the form design window. But the question is that it expects only a "call" to procedure. But where do I define the procedure then? If I insert the procedure from the backend, it gets flushed the next time I compile my form.
Hope I am able to explain my point.
Thanks in advance,
Abbas. -
Explain plans for PL/SQL code?
Hi!
I am pulling SQL statements (select, insert, update, delete, etc.) from PL/SQL code and producing explain plans. Some of the delete statements have "WHERE CURRENT OF" in them which produces an ORA-3001 error (feature not implemented) error. How can I do an explain plan of these statements? Can I replace "WHERE CURRENT OF" with "=" to get a plan? How far off will the plan be? Any suggestions, ideas, etc. greatfully appreciated!
This is Oracle 9.2.0.4/5 on AIX if it makes a difference.
Thanks!
Dave VenusWHERE CURRENT OF shouldn't be a problem. Here above an example on 9.2.0.4 on AIX5.2 :
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
SQL> create table TBL_USER_PROFILE_CATEGORY
2 as
3 select 654 id_category, 1103 id_user from dual union all
4 select 654 id_category, 1104 id_user from dual union all
5 select 18 id_category, 1103 id_user from dual union all
6 select 629 id_category, 1103 id_user from dual union all
7 select 110 id_category, 1103 id_user from dual union all
8 select 110 id_category, 1104 id_user from dual union all
9 select 18 id_category, 1104 id_user from dual union all
10 select 37 id_category, 1103 id_user from dual union all
11 select 24 id_category, 1103 id_user from dual union all
12 select 7 id_category, 104 id_user from dual union all
13 select 37 id_category, 1104 id_user from dual union all
14 select 22 id_category, 1103 id_user from dual union all
15 select 22 id_category, 1104 id_user from dual union all
16 select 25 id_category, 1104 id_user from dual union all
17 select 25 id_category, 1103 id_user from dual ;
Table created.
SQL>
SQL> alter table TBL_USER_PROFILE_CATEGORY add primary key (id_category, id_use
Table altered.
SQL>
SQL> CREATE OR REPLACE
2 PROCEDURE P$UPDATE_TBL_USER_PROFILE_CAT(p_id_cat_old IN NUMBER) AS
3 p_id_category number;
4 p_id_user number;
5 cursor mycur is select id_category, id_user
6 from TBL_USER_PROFILE_CATEGORY
7 where id_category = p_id_cat_old
8 for update of id_category;
9 BEGIN
10 open mycur;
11 LOOP
12 FETCH mycur INTO p_id_category, p_id_user;
13 EXIT WHEN mycur%NOTFOUND;
14 BEGIN
15 DELETE FROM TBL_USER_PROFILE_CATEGORY
16 WHERE CURRENT OF mycur;
17 END;
18 END LOOP;
19 CLOSE mycur;
20 COMMIT;
21 EXCEPTION WHEN OTHERS THEN rollback;
22 END;
23 /
Procedure created.
SQL>
SQL> exec P$UPDATE_TBL_USER_PROFILE_CAT(654)
PL/SQL procedure successfully completed.
SQL> select * from TBL_USER_PROFILE_CATEGORY;
ID_CATEGORY ID_USER
18 1103
629 1103
110 1103
110 1104
18 1104
37 1103
24 1103
7 104
37 1104
22 1103
22 1104
25 1104
25 1103
13 rows selected.
SQL> Please, paste here what's your code...
Nicolas. -
OnClick for PL/SQL Code???
Hello,
I created a form and added a button. When that button is pressed, I want to execute PL/SQL code. In the list of JavaScript Event Handlers there is an event 'OnClick'. But I see nothing simular for the PL/SQL Button Event Handler.
Where do I have to put my code?
Thanks for your help.
Nancy.I don't know how it is on this special app but what I do know is You have to submit Your form because PL?SQL procedures run only on server
So You click on a button, link or whatever, PL/SQL procedure runs on the server and generates something to output again to client -
How to generate WebServices for PL/SQL Packages
I have the following issue trying to generate WS for a selected set of operations within a PL/SQL package
If I use the option -sql PKG_TEST then I am getting all operations within a package.
I just want to expose a certain number of procedures ( e.g. PROC1 and PROC2 )
It works only if I specify
-sql PKG_TEST(PROC1)
when I use -sql PKG_TEST(PROC1, PROC2) it gives me errors.
I have Oracle JDeveloper (10.1.3.2) (Build 4066) .
I used wsa with an plsqlAssemble option
java -jar wsa.jar -plsqlAssemble
-appName myApp
-packageName myPckg
-sql PKG_TEST(PROC1)
-dataSource jdbc/ds
-dbConnection jdbc:oracle:thin:@zzzz:1521:mydb -dbUser user/passw
-style rpc
-use literal
Thanks,
Michael HitrikEric,
Thanks a lot for your help.
I was able to follow all of your recommendations
I was able to produce the single ear file for multiple PL/SQL packages .
Now I have the last step ( I hope :-) - WS-SECURITY
What is your recomendation for Security - specifically for WebServices for PL/SQL Packages ?
I would like to do the following:
CLIENT CODE:
* Create a XML element with user name, password, &
* datasource as child elements.
* Element will look like this:
* <credetials>
* <username>scott</username>
* <password>tiger</password>
* <datasource>jdbc/OracleCoreDS</datasource>
* </credentials>
Document doc = new XMLDocument();
Element elAdd = doc.createElement( "credentials");
Element elA = doc.createElement( "username");
Element elB = doc.createElement("password");
Element elC = doc.createElement("datasource");
elA.appendChild(doc.createTextNode("scott"));
elB.appendChild(doc.createTextNode("tiger"));
elC.appendChild(doc.createTextNode("jdbc/OracleCoreDS"));;
elAdd.appendChild(elA);
elAdd.appendChild(elB);
elAdd.appendChild(elC);
doc.appendChild(elAdd);
Element e = doc.getDocumentElement();
// Create an intance of the proxy
EmployeeProxy proxy = new EmployeeProxy();
// Create a Header objecy
Vector v = new Vector();
v.add (e);
Header hdr = new Header();
hdr.setHeaderEntries(v);
// Set the Header
proxy._setSOAPRequestHeaders(hdr);
SERVER CODE:
public void processHeaders(Header header)
throws java.io.IOException,
oracle.xml.parser.v2.XSLException
// Get all the Elements
Vector entries = header.getHeaderEntries();
Element e = (Element) entries.firstElement();
System.out.println("Element received from SOAP header is: " );
((XMLElement)e).print(System.out);
// Get independent nodes and retrieve node values.
Node userNode;
userNode = ((XMLNode)e).selectSingleNode("username");
userName = ((XMLElement)userNode).getText();
Node passwordNode;
passwordNode = ((XMLNode)e).selectSingleNode("password");
password = ((XMLElement)passwordNode).getText();
Node dsNode;
dsNode = ((XMLNode)e).selectSingleNode("datasource");
datasourceName = ((XMLElement)dsNode).getText();
System.out.println("User name is: " + userName);
System.out.println("Password is: " + password);
System.out.println("Datasource is: " + datasourceName);
How can this be done with the generated code using wsa tool ?
Any other suggestions ?
Thanks,
Michael -
How do i allow for a discount code or other discount on my form?
How do allow for a discount code or other discount on the form?
I am assuming you want to use paypal with this form which mean you need to use an HTML form. Unfortunately Formscentral doesn't support calculations with HTML forms. This is going to make discounts difficult. Depending on your exact needs you might be able to get away with using different fields for the discount. Example. Item one is standard room rate. Item two might be the same room with a AAA discount applied. etc. You will have to play with it to see if you can get it to do what you want.
Andrew -
How to invoke jdb for this simple code
up to now i have been debugging by looking at the code, could someone please tell me how
to invoke jdb for the following example, and how would i look at the local values within x & y
(without having to rely on JOptionPane):
//pg73 ex2.16 The x value input must be larger than the y value
import javax.swing.JOptionPane;
public class ex2_11
public static void main(String args[])
int x =2, y=3;
JOptionPane.showMessageDialog( null,
"a x= " x "\n " +
"b the value of x+x is " + (x+x) + "\n " +
"c x= " + "\n " +
"d " + (x+y) + "= " + (y+x),
"Results",JOptionPane.PLAIN_MESSAGE);
System.exit(0);I think I have already answered this question somewhere else, but I will reiterate it here.
If you have compile errors in your source code (i.e. you left the semi-colon off at the end of a statement), a class file will not get generated.
What you have done is the following:
1. created a working java source file
2. compiled that file and generated a class file
3. then changed the working source file and introduced a compiler error (i.e. you left the semi-colon off at the end of a statement)
4. then attempted to compile the file (with javac), but due to the compiler error a new class file did not get generated (therefore the old class file from the previous compile still resides on your machine).
5. Then you ran jdb on the old previously generated class file.
To confirm what I am saying is true. Delete the class file, then try to generate it again after introducing your compiler error. A new class file will not get generated and therefore you won't be able to use jdb (as jdb requires the class files).
Hope this helps (and gets me the duke dollars),
Tim -
How to calculate HASH_VALUE for Specific SQL
I have an auditing trigger and want to filter out known statements.
I can, from within the trigger, obtain the SQL that fired the trigger (dbms_standard.sql_txt function).
I want to be able to calculate the HASH_VALUE for this SQL to use in a decision tree.
If I have auditing enabled (I do) I can use the audsid {sys_context('USERENV','SESSIONID')} to lookup my SID and from there peruse several V$ views. This seems rather cumbersome.
Does anyone know of a built-in function to either calculate the HASH_VALUE, when given SQL_TEXT or to return the HASH_VALUE for the firing SQL statement?
ThanksHi,
SQL> select count(1) from user_tables;
COUNT(1)
21805
SQL> select hash_value,sql_text
2 from v$sqlarea
3 WHERE sql_text LIKE 'select count(1) from user_tables%';
HASH_VALUE
SQL_TEXT
2802460921
select count(1) from user_tables
SQL> Nicolas. -
How to reset data for the company code 1000
Hi Gurus,
I am practicing SAP SD on a sandbox server as am learning it.
But i see that the standard data for the company code 1000 has been altered by previous users and most of the standard setttings have been changed.
Due to this am having a lot of issues while configuring a new company code by copying it from 1000.
Please help me reseting the data for the company code 1000 so that it will be easier for customizing and learning.
Regards,
HarishHi Harish,
Follow the step given below
SPRO --> Enterprise Structure --> Definition --> Financial Accounting --> Edit, Copy, Delete, Check Company Code
A pop screen will appear which will give you two options
1) Copy, delete, check company code
2) Edit Company Code Data
Select option one
On next screen --> Click at " Check org. object" or press F8 --> It will ask your company code --> enter your company code 1000 --> Enter
It will check all the related table and if it find any discrepency
then it will show you one pop up screen
Errors in
foreign key dependencies
Do you want the error log
displayed now?
Click at Display now --> correct all the fields which are wrongly maintained.
Hope this helps
Regards,
MT -
How to block postings for particular company code ?
Hello All,
I have a scenario like FI document shouldn't generate automatically when I invoice with reference to order/delivery document.
Just I want only Invoice number but not FI document (It should park instead of creating automatically) for particular company code among all and later I will create manual FI document with reference to that Invoice.
Existing solutions:
1.Can control in document functionality but I am using single document for all company codes
2.Can control using FD02 transaction but I have many customers
Please suggest any new solution other than above.
Regards,
GangadharHi,
Please check the below thread:-
Re: VF01: Prevent document posting in FI via user exit
It should be useful in your situation.
Regards,
Gaurav -
How to get accurate results from sql code ?
Hello everybody,
I have a problem with some portion of my code.
I get more results than I specify in the where clause.
Here is the sample code:
c.gl_acct_id between '110'||'-'||'6890'||'-'||'69000'||'-'||'%'
and '110'||'-'||'7000'||'-'||'67999'||'-'||'%'
For some reason I also get the following results back:
110-6910-51001-001, and 110-6910-51003-001 But I don't need the 51001 and 51003. How do I specify in sql what range I really want. I was sure that the code above is correct. I guess not.
I would appreciate any help,
Thanks,
SonyaHave you tried using the query either of the following...
1) c.gl_acct_id between '110-6890-69000-000'
and '110-7000-67999-999'
and c.gl_acct_id not like '110-6910-51001-%'
and c.gl_acct_id not like '110-6910-51003-%'
assuming you have only 3 digits at the end of gl_acct.
2)If you know that your acct_id belongs to only 69000 or 67999
then
(c.gl_acct_id LIKE '110-6890-69000-%' OR
c.gl_acct_id LIKE '110-7000-67999-%' )
Plz. let me know if this not what you are looking for.
thanx
rajkiran
Here is the whole script:
select distinct c.gl_acct_id acct_no,
c.gl_acct_desc,
min(a.local_act_beg_bal) local_act_beg_bal,
sum(b.local_act_mtd_dr_amt) debits,
sum(b.local_act_mtd_cr_amt) credits,
nvl(min(a.local_act_beg_bal),0)+sum(nvl(b.local_act_mtd_dr_amt,0))-
sum(nvl(b.local_act_mtd_cr_amt,0)) end_bal
from gl_acct c, gl_acct_bal a, gl_acct_bal b
where c.org_unit_id = '110'
and b.gl_acct_id = c.gl_acct_id
and a.gl_acct_id = c.gl_acct_id
and c.sum_det_ind = 'D'
and c.gl_acct_class_ind in ( 'A' , 'L' , 'Q' , 'I' , 'E' )
and a.year_no = '2001'--:loyear
and a.period_no = '1'--:loperiod
and ( ( b.year_no = '2001'--:hiyear
and b.period_no between '1'--:loperiod
and'13')-- :hiperiod
and c.gl_acct_id between '110'||'-'||'6890'||'-'||'69000'||'-'||'%'
and '110'||'-'||'7000'||'-'||'67999'||'-'||'%'
group by c.gl_acct_id, c.gl_acct_desc
I want to have ability to specify ranges for gl_accoount.
Thanks,
Sonya -
How to create request for extracting company code
Hi All,
Can any body guide me how to create a request for extraction of company code 0COMP_CODE_ATTR.
Actually i have created a request using transport conneciton but while moving this request to quality system i am getting following error.
DataSource 0COMP_CODE_TEXT does not exist in source system QLTCLNT440 of version A
Mapping between data source 0COMP_CODE_TEXT and source system QLTCLNT440 is inconsistent
DataSource 0COMP_CODE_TEXT does not exist in source system QLTCLNT440 of version A
Field KEY1 will not be delivered from DataSource 0COMP_CODE_TEXT in source system QLTCLNT440
Field TXTMD will not be delivered from DataSource 0COMP_CODE_TEXT in source system QLTCLNT440
Start of the after-import method for object type R3TR ISTS (Activation Mode)
Reference to transfer structure 0COMP_CODE_TEXT_BB not available. No activation possible.
Start of the after-import method for object type R3TR ISTS (Delete Mode)
Start of the after-import method for object type R3TR ISMP (Delete Mode)
Errors occurred during post-handling RS_AFTER_IMPORT for ISMP L
The errors affect the following components:
BW-WHM (Warehouse Management)
Actually i have checked in Quality system 0COMP_CODE_TEXT is availble active. But i think we have to use 0COMP_CODE_ATTR data source...
Pls help,,,
Regards,
viren.Hi Viren,
Glad that your problem is resolved.
Help.Sap.com is the best reference: http://help.sap.com/saphelp_nw04/helpdata/en/b2/e50138fede083de10000009b38f8cf/frameset.htm
Also check the "How-To" docs in https://www.sdn.sap.com/irj/sdn/developerareas/bi
Bye
Dinesh -
How to estimated time for oracle sql query
i have query run every month on production server to collect some information
data size is difference every month
what i need to estimate the time before running
how can i do thatsorry this is what i get
when i caculate time column it give me 10 sec
but when i make this
SQL> set timing on;
SQL> select * from tab;
3658 rows selected.
Elapsed: 00:00:05.50
so whay in the first give me 10 sec and the secand give me 5.50 sec
SQL> explain plan for select * from tab;
Explained.
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 457676135
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1243 | 104K| 182 (4)| 00:00:03 |
| 1 | NESTED LOOPS OUTER | | 1243 | 104K| 182 (4)| 00:00:03 |
|* 2 | TABLE ACCESS FULL | OBJ$ | 1243 | 98197 | 142 (5)| 00:00:02 |
| 3 | TABLE ACCESS CLUSTER| TAB$ | 1 | 7 | 1 (0)| 00:00:01 |
|* 4 | INDEX UNIQUE SCAN | I_OBJ# | 1 | | 0 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
Predicate Information (identified by operation id):
2 - filter("O"."TYPE#"<=5 AND "O"."OWNER#"=USERENV('SCHEMAID') AND
"O"."TYPE#">=2 AND "O"."LINKNAME" IS NULL)
4 - access("O"."OBJ#"="T"."OBJ#"(+))
18 rows selected.
SQL>
Edited by: 862640 on Nov 27, 2011 1:43 AM
Edited by: 862640 on Nov 27, 2011 1:49 AM
Edited by: 862640 on Nov 27, 2011 1:53 AM -
Syntax check for PL/SQL code??
is there any tool with which we can check the syntax for code written in Pl/ SQL???
Please help...Hi,
I think Asit is trying to point you to a product called TOAD (Asit, pls correct if I'm wrong):
http://www.quest.com/toad/
http://www.toadsoft.com/feats.html
http://www.samspublishing.com/articles/article.asp?p=31544&rl=1
Regards,
Ville
Maybe you are looking for
-
How to find out if a socket connection is interrupted
Hi guys in one of my programs a thread checks every second, if in the DataInputStream of the socket is a new string to show. But if the connection is interrupted, it gets every second the string "null". How can I check if the connection is interrupte
-
We have written a command line program that receives orders in a number of different formats by email and parses them to a common xml structure. We want to pass this xml document to a PL/SQL procedure that breaks it apart and inserts the elements int
-
In FrameMaker, when I try to save a FrameMaker file as a PDF file, I get the following message: "FrameMaker could not find Adobe PDF printer instance, which must be installed to execute "Save as PDF" command". I have a sinking feeling that I deleted
-
Hi I was going thru the help.sap for IDoc adapter. Implementation Considerations Only use the IDoc adapter to integrate SAP systems with the Integration Server if a scenario of this kind suits your requirements. in http://help.sap.com/saphelp_nw04/he
-
Most options in itunes "create new version" greyed
itunes only gives me the option to create an apple lossless version when i select a song in my playlists or general music section to create a new version. This doesn't make sense as most of my music was uploaded using applelossless. The average son