Can we declare trigger in package
Hi
Can we declare trigger in package specification and body of trigger in package body. If so just give me the syntax.
Thanks
No. Just think: trigger would be firing on what? :-)
But you can call (packaged) procedure from trigger.
Similar Messages
-
Can we declare a Cursor in Package Specs?
Dear buddies
Can I Declare a Cursor in Package Specs so that I can call that cursor and use its data in some procedures and functions of package. Otherwise I've to write that cursor for every sub-program of a package which I don't feel a smart way to accomplish the job.Hi,
here is a short example with the whole way down. Maybe the concept is getting clearer with this:
first of all, if you do not have the table emp, here the DDL for this example.
Be carefull, works only for german clients because of the names of months, sorry for that.
CREATE TABLE EMP
(EMPNO NUMBER(4) NOT NULL,
ENAME VARCHAR2(10),
JOB VARCHAR2(9),
MGR NUMBER(4),
HIREDATE DATE,
SAL NUMBER(7, 2),
COMM NUMBER(7, 2),
DEPTNO NUMBER(2));
set echo on
INSERT INTO EMP VALUES
(7369, 'SMITH', 'CLERK', 7902,
TO_DATE('17-DEZ-1980', 'DD-MON-YYYY'), 800, NULL, 20);
INSERT INTO EMP VALUES
(7499, 'ALLEN', 'SALESMAN', 7698,
TO_DATE('20-FEB-1981', 'DD-MON-YYYY'), 1600, 300, 30);
INSERT INTO EMP VALUES
(7521, 'WARD', 'SALESMAN', 7698,
TO_DATE('22-FEB-1981', 'DD-MON-YYYY'), 1250, 500, 30);
INSERT INTO EMP VALUES
(7566, 'JONES', 'MANAGER', 7839,
TO_DATE('2-APR-1981', 'DD-MON-YYYY'), 2975, NULL, 20);
INSERT INTO EMP VALUES
(7654, 'MARTIN', 'SALESMAN', 7698,
TO_DATE('28-SEP-1981', 'DD-MON-YYYY'), 1250, 1400, 30);
INSERT INTO EMP VALUES
(7698, 'BLAKE', 'MANAGER', 7839,
TO_DATE('1-MAI-1981', 'DD-MON-YYYY'), 2850, NULL, 30);
INSERT INTO EMP VALUES
(7782, 'CLARK', 'MANAGER', 7839,
TO_DATE('9-JUN-1981', 'DD-MON-YYYY'), 2450, NULL, 10);
INSERT INTO EMP VALUES
(7788, 'SCOTT', 'ANALYST', 7566,
TO_DATE('09-DEZ-1982', 'DD-MON-YYYY'), 3000, NULL, 20);
INSERT INTO EMP VALUES
(7839, 'KING', 'PRESIDENT', NULL,
TO_DATE('17-NOV-1981', 'DD-MON-YYYY'), 5000, NULL, 10);
INSERT INTO EMP VALUES
(7844, 'TURNER', 'SALESMAN', 7698,
TO_DATE('8-SEP-1981', 'DD-MON-YYYY'), 1500, 0, 30);
INSERT INTO EMP VALUES
(7876, 'ADAMS', 'CLERK', 7788,
TO_DATE('12-JAN-1983', 'DD-MON-YYYY'), 1100, NULL, 20);
INSERT INTO EMP VALUES
(7900, 'JAMES', 'CLERK', 7698,
TO_DATE('3-DEZ-1981', 'DD-MON-YYYY'), 950, NULL, 30);
INSERT INTO EMP VALUES
(7902, 'FORD', 'ANALYST', 7566,
TO_DATE('3-DEZ-1981', 'DD-MON-YYYY'), 3000, NULL, 20);
INSERT INTO EMP VALUES
(7934, 'MILLER', 'CLERK', 7782,
TO_DATE('23-JAN-1982', 'DD-MON-YYYY'), 1300, NULL, 10);2. Package Spec:
create or replace
package test_cursor as
--Type for the returncode of the function
TYPE typ_emp IS TABLE OF emp%rowtype;
--Array for fetching, of course also possible in the body
t_emp typ_emp;
--function wich returns the array from fetching the cursor
function get_emp return typ_emp;
--function for manupilation data retrieved by the function
PROCEDURE man_emp;
end test_cursor;3. Package Body
create or replace
package body test_cursor as
FUNCTION get_emp RETURN typ_emp AS
cursor c_emp is select * from emp;
BEGIN
open c_emp;
fetch c_emp BULK COLLECT INTO t_emp;
CLOSE c_emp;
--t_emp returns the whole table set from emp
return t_emp;
end get_emp;
PROCEDURE man_emp AS
--just for not confusing names, is the same as t_emp of course
v_emp_array typ_emp;
BEGIN
--call the function and retrieve the whole data set
v_emp_array := get_emp;
--now manipulate the data, in this case just write the names to the calling client
FOR rec IN v_emp_array.FIRST .. v_emp_array.LAST
loop
dbms_output.put_line(v_emp_array(rec).ename);
end loop;
end man_emp;
end test_cursor;4. Calling the procedure
SET serveroutput ON
exec test_cursor.man_emp;5. And this is the result:
anonymer Block abgeschlossen
SMITH
ALLEN
WARD
JONES
MARTIN
BLAKE
CLARK
SCOTT
KING
TURNER
ADAMS
JAMES
FORD
MILLERPlease be aware, this is just for demonstration purpose, of course it makes no sense to display the names this way. But how to call a funktion returning arrays with datasets from fetching cursors is shown here.
Hth
Joerg -
Can we create a StructDescriptor for a pl/sql Type declared in a Package?
Hi,
I went thru many threads on the forum regarding passing Structs and Arrays from java to pl/sql and back. In one of the threads, Tom Trevor has asked this question, but I do not see any definitive answer there. (if it's there, maybe I didn't get it).
I want to refer to a pl.sql Type (Record) declared inside a package while creating a StructDescriptor. Is this possible?This is only possible, when u define ur custom type globally. The reason being, in JDBC code when u define struct statement, the code with db connection in constructor finds that if the custom type is present in DB , it does not search in specific procedure, so it would only get this , if ur cuustom type is defined globally.
--Mukul -
View of variables declared within a package/procedure
Does anyone know of a view which holds all the variables declared within a package/function/procedure?
I can see that _arguments holds the parameters defined.
PLSQL Developer displays these things in their drop downs, so I assume they are either getting it from a view or have written something which parses the _source view?Do you mean this ?
SCOTT@db102 SQL> desc dbms_output
PROCEDURE DISABLE
PROCEDURE ENABLE
Argument Name Type In/Out Default?
BUFFER_SIZE NUMBER(38) IN DEFAULT
PROCEDURE GET_LINE
Argument Name Type In/Out Default?
LINE VARCHAR2 OUT
STATUS NUMBER(38) OUT
PROCEDURE GET_LINES
Argument Name Type In/Out Default?
LINES TABLE OF VARCHAR2(32767) OUT
NUMLINES NUMBER(38) IN/OUT
PROCEDURE GET_LINES
Argument Name Type In/Out Default?
LINES DBMSOUTPUT_LINESARRAY OUT
NUMLINES NUMBER(38) IN/OUT
PROCEDURE NEW_LINE
PROCEDURE PUT
Argument Name Type In/Out Default?
A VARCHAR2 IN
PROCEDURE PUT_LINE
Argument Name Type In/Out Default?
A VARCHAR2 IN
SCOTT@db102 SQL> -
Can we use dbms_output.put_line package with forall statement
Hello Everybody
Can we use dbms_output.put_line package with forall or can we use insert,update and delete only
declare
type emp_rec is table of emp%rowtype
index by binary_integer;
t emp_rec;
begin
select * bulk collect into t from emp;
forall i in t.first..t.last
dbms_output.put_line(t(i).name);
end;Thanks & Regards
peeyush
Edited by: Peeyush on Nov 25, 2010 11:45 PMMichaelS wrote:
Well as the docs explain (though not very clear and detailed, I admit) you can use a dynamic sql statement (execute immediate) with FORALL.You got me interested in the performance side doing this Michael - running PL/SQL code via a FORALL loop.
It is faster than using a normal FOR loop to execute dynamic PL/SQL - a bit surprising as I expected another context switch to be in there. But seems like the PL/SQL engine is a more clever at optimisation than what I originally credited it with.. ;-)
Of course - pre-compiled/static PL/SQL code in a FOR loop is the fastest, as expected.
SQL> declare
2 type TNumbers is table of number;
3
4 type TTimes is record(
5 for_all number,
6 for_dynamic number,
7 for_static number
8 );
9
10 type TTimesTable is table of TTimes;
11
12 MAX_ITERATIONS constant number := 10;
13
14 plBlock varchar2(1000) :=
15 'declare i number;
16 begin i:= :var / 10; end;';
17
18 performance TTimesTable;
19 t1 number;
20 bindVar TNumbers;
21 n number;
22 begin
23 select
24 level bulk collect into bindVar
25 from dual
26 connect by level <= 10000;
27
28 dbms_output.put_line( 'Iterations: '||bindVar.Count||' for loop cycle(s)' );
29
30 performance := new TTimesTable();
31 performance.Extend( MAX_ITERATIONS );
32
33 for j in 1..MAX_ITERATIONS
34 loop
35 t1 := dbms_utility.get_time;
36 forall i in 1..bindVar.Count
37 execute immediate plBlock using bindVar(i);
38 performance(j).for_all := dbms_utility.get_time-t1;
39
40 t1 := dbms_utility.get_time;
41 for i in 1..bindVar.Count
42 loop
43 execute immediate plBlock using bindVar(i);
44 end loop;
45 performance(j).for_dynamic := dbms_utility.get_time-t1;
46
47 t1 := dbms_utility.get_time;
48 for i in 1..bindVar.Count
49 loop
50 n := bindVar(i) / 10;
51 end loop;
52 performance(j).for_static := dbms_utility.get_time-t1;
53 end loop;
54
55 dbms_output.put_line( 'Times in 100th of a second' );
56 dbms_output.put_line( rpad('for all',15) || rpad('for dynamic',15) || rpad('for static',15) );
57 for i in 1..performance.Count
58 loop
59 dbms_output.put_line(
60 rpad( performance(i).for_all, 15 )||' '||
61 rpad( performance(i).for_dynamic, 15 )||' '||
62 rpad( performance(i).for_static, 15)
63 );
64 end loop;
65
66 end;
67 /
Iterations: 10000 for loop cycle(s)
Times in 100th of a second
for all for dynamic for static
10 72 0
6 37 0
6 37 0
6 37 0
6 36 0
6 37 1
5 37 0
5 37 0
6 37 1
5 37 0
PL/SQL procedure successfully completed.
SQL> -
Use exceptions declared in remote package
Hi,
When handling exceptions, I use their name as declared inside the package from where they are thrown:
MY_PACKAGE.OPERATION;
EXCEPTION
WHEN MY_PACKAGE.MY_EXCEPTION THEN
Now I'm using a package in a remote database however, so I try:
MY_PACKAGE.OPERATION@REMOTE_DB;
EXCEPTION
WHEN MY_PACKAGE.MY_EXCEPTION@REMOTE_DB THEN
This fails with:
PLS-00103: Encountered the symbol "@" when expecting one of the following: . then or The symbol ". was inserted before "@" to continue.
Am I missing something or is this a known database bug or something?
Thanks,
K.Oooh, OK, I see, we have a bit of a misunderstanding here.
I do raise an "Application exception" through RAISE_APPLICATION_ERROR() in the remote procedure, and the appropriate exception number is returned to the local procedure.
The problem is when it comes to catching the exception. I can have error -20101 in both packages, and because they're different packages, the number is assigned to different kind of errors. If I catch the remote exception as the local number, I have a mix of definitions, which is really not advisable.
We do the same thing between local packages:
create or replace
PACKAGE A AS
TEST_E EXCEPTION;
PRAGMA EXCEPTION_INIT(TEST_E, -20101);
PROCEDURE TEST;
END A;
create or replace
PACKAGE BODY A AS
PROCEDURE TEST IS
BEGIN
RAISE_APPLICATION_ERROR(-20101, 'test');
END;
END A;
create or replace
PACKAGE B AS
DIFFERENT_E EXCEPTION;
PRAGMA EXCEPTION_INIT(DIFFERENT_E, -20101);
PROCEDURE TEST;
END B;
create or replace
PACKAGE B AS
PROCEDURE TEST IS
BEGIN
A.TEST;
EXCEPTION
WHEN A.TEST_E THEN
NULL;
END;
END B;
This works locally, but if package A is declared remotely, catching A.TEST_E@REMOTE_DB inside B.TEST won't compile. Catching A.TEST_E as B.DIFFERENT_E really isn't nice and very confusing.
So, is this a database bug?
Any suggestions that don't imply changing all error numbers in all our packages to be unique (which is almost impossible for the amount of work and the limit in number of application exceptions)?
Thanks,
K. -
How can i declare a single radio button field in selection-screen ?
How can i declare a single radio button field in selection-screen ?
>
Rob Burbank wrote:
> And how will you turn it off once it is turned on??
>
> Rob
Thats correct ;)...See ravi if users will ask so many things its our Job to convay the correct solution ....
Just post your org requirement..SOo some body guide you better//
Sas -
How can I deploy only one package out of a big project?
Does any one know how can I only deploy one package out of a big project?
We have a project which includes about 12 differenct packages. Is there a way in Jdeveloper for me to create a deploy profile to only deploy one package to a *.jar file?
Do I have to re-create a new project ( that's what I am doing currently) simply for deployment purpose?
By the way, click and pick class from more than 100 classes is too much of work. In addition, you don't really know exactly which class you are picking if two classes (in different packages) have the same name.
Thanks a lot.Rename your LCA file extention into .ZIP
Open the ZIP file in any of the compressing utility (e.g. WinZip, WinRar etc.)
Extract the desired process and deploy it manually to your server.
Nith -
BT can't find my broadband package - Help/advice n...
Hello
So glad I found this forum – I'm in need of some help before I go mad!
I have been a BT internet customer for nearly 10 years.
The trouble started at the end of July when I tried to add BT sport free (I have Sky). I couldn't do it online, so I went on online chat and they said I didn't have a broadband account with them. After an hour of me trying to convince them that I am a customer, they finally said they couldn't help me other than to suggest I talk to sales to add broadband to my account – I already have BT broadband!
I then emailed the residential customer services team via the complaints route to express my dismay at the poor treatment of a long-term loyal customer and to request that they intervene and sort the situation out for me.
They repeated that I only have landline showing with them and asked whether I had another account number. My internet has always been billed separately to my phone account, but looking through all my documents I couldn't see that I'd ever had an account number for my internet service.
I discovered when I looked at my account in BT Yahoo email, that I was still on the BT Yahoo Anytime Plus service, but there was no account number to be seen anywhere. Like many people on this forum I received occasional emails from BT at the end of 2011 saying that I would be transferred to BT Total Broadband Option 1 at some point, but this obviously never happened.
On reading this forum I discovered that there are a number of people like me who have 'unaligned' accounts where they're still on an old service that is billed separately and not linked to their MyBT account. I also read on this forum that someone had managed to find their separate internet account number by checking their bank statement direct debit info. I did this and managed to find an account number (starting GB followed by 8 numbers) but I've tried to use it online myself and it isn't recognised, so I've emailed the residential services team with this number.
They haven't replied to me yet – it's well past the 72 hours they're supposed to reply in – and I've got a strong feeling they're just going to say they can't find the account number on their system. If they reply at all.
Interestingly, I went onto my BT Yahoo email account page today and my internet product had changed from BT Yahoo Anytime Plus to BT Total Broadband Option 1.
Now, I don't know if my message has triggered some action at BT's end, but if it has they haven't told me. My big concern now is that my BT Yahoo Anytime Plus was unlimited with no contract and it now looks like I've been moved to a product with a tiny 10GB limit. I run an online business so I'm rarely offline and I'd exceed my limit within a few days. I'm worried that I'm already exceeding my usage, and if I hadn't looked I wouldn't even know I'd been moved.
All I want is for BT to recognise and merge my accounts, and then I can upgrade to an unlimited package (which will cost less than what I'm paying now anyway). And then I can also add BT Sport, to which I'm entitled and not able to get because BT's systems are rubbish.
I'd thought about simply cancelling my existing direct debit and ordering a new broadband package, but I really need to keep my email address as I've had it for years and I use it for business.
I've seen that there are lovely mods on this forum who can help, so I'm hoping one can come to my rescue before I pull all my hair out – I've got nowhere so far and it's been more than 6 weeks since my intial contact with BT.
Apologies for the length of this message!
Many Thanks,
Justine
Solved!
Go to Solution.Hello again
Can anybody tell me how long it normally takes for the mods to reply to a contact form please? I submitted an enquiry via RobbieMacs's profile link on 18 September and have not yet received a reply or acknowledgement. Does it normally take a few days to hear back from them?
My problem has also worsened. As I mentioned above, someone has been tinkering with my account because last week I was moved without warning from BT Yahoo Anytime plus service to BT Total Broadband Option 1, without being informed. Then on Friday I received a 'Welcome to BT Broadband' email (I've had BT Broadband for nearly 10 years!), and last night I for the first time ever in nearly 10 years I received a usage warning.
So, not only has my account been moved without telling me, but I've been moved from an unlimited service to a capped service (for the same price) and I'm close to reaching my limiit after a few days usage.
But, despite the behind-the-scenes tinkering, my internet product still hasn't been merged with MyBT account so I cannot access it online to upgrade to an unlimited package, and I cannot call them as they will just tell me they have no record of me having broadband with them (I've been told this too many times over the last few weeks and it drives me crazy everytime - it's as if they think I'm making it up!).
I'm so close to jumping ship to Virgin, and I think if I start incurring extra usage charges because I've been moved on to a product I currently have no control over, it may well be the last straw!
Thanks,
Justine -
Can I Test the Test Package Created in SolMan Directly from ECC?
Hi,
the test plan and test packages are created in Solution Manager. The Test Packages are comprised of transactions (on ECC).
(The business scenarios and processes are defined in Solar01, ECC is defined as logical component and assigned to every tx, the test case description is uploaded in Solar02,...)
The needed Trusted RFC (to enable the tester to start the tx from within SolMan) is running late, but I can see that STWB_WORK tx is also available in ECC.
Of course - when I open it in ECC (logged on as a test user - defined in test package in SolMan) the test package is empty in ECC.
What kind of connection is there within STWB_WORK in ECC and SolMan?
Can one somehow "transfer" the packages from SM to ECC, so the tester can start to test the transactions from ECC directly?
Is it possible to see the results and status overview in SolMan during and after testing?
Thank you in advance,
cheers,
NenadHi
You getting confused between old ECC test workbench and Solution Manager Test workbench.
Test workbench is present there from r/3 version onwards.
When you are performing testing via solman then you have to use the test packages assign to you in STWB_WORK which has the relevant transaction and doc for you to test
here you upload the test result and update status .Later any PM can generate report for overall testing including entire landscape and not one system.
But remember it has got no connection to ur r/3 workbench
The diff between 2 is...solman test workbench is for entire landscape including BI R/3 ECC any other system ...but in r/3 etc the workbench is alone and obsolete now is used for standalone testing.
Hope it carifies ur doubt completely
Regards
Prakhar -
How can we use the same package in our report used by some other report
how can we use the same package in our report used by some other report
Hi,
You just need to assign package while saving your report.
No extra is required providing you are aware of package to be used. -
Where can I download adobe File Packager tool for Windows?
Dear all,
I need to understand the detail format of f4f files, but the only useful information I can find is the following:
http://www.adobe.com/products/httpdynamicstreaming/pdfs/httpdynamicstreaming_wp_ue.pdf
Is there more detail specification for f4f ?
Where can I download adobe File Packager tool for Windows?
It seems to me the following specification is not correct for f4f, at least the parts talking about "mdat" box
http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf
Thanks,
XuedongAs per your question – follow this link http://www.adobe.com/products/adobe-media-server-family.html, download and install AMS Starter, then inside \tools\f4fpackager you’d find the F4F packager command-line application.
-
SQLDeveloper 3.2 - I can't see trigger code
Hi people
In some cases, I can't see trigger code.
I didn't find a pattern to determine what kind of trigger has an invisible code.
For example, in my instance I can't see code of SCOTT.AFTER_INS_UPD_ON_EMP trigger, but I see it in SQL tab for SCOTT.EMP table.
I had to copy from there and recreate trigger. Now is visible
I work with EBS R12, and a list of some triggers with that problem follows:
AR_RECEIVABLE_APPLICATIONS_BRI
AS_JTF_RS_GROUP_MEM_BI
FND_FLEX_VAL_RULE_LINES_T1
FND_FLEX_VALIDATION_RULES_T1
FND_SECURITY_GROUPS_IL
HR_LOCATIONS_ALL_OVN
PAY_TEMPLATE_EXCLUSION_RUL_WHO
PER_ALL_PEOPLE_F_OVN
PER_PERSON_ANALYSES_OVN
PER_PSV_OVN
WIP_DISCRETE_JOBS_BRD
My info:
SQL Developer 3.2.09.30
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit
Thanks
OscarHi Oscar,
Possibly your issue may be the same as this very recently logged and fixed bug:
Bug 14530780 - TRIGGERCODE IN OTHER SCHEMA NOT VISIBLE IN BROWSER, HOWEVER QUERIABLE IN SQLWORK
But the bug narrative never claims it is a regression, so presumably it also would have been a problem in prior releases.
Regards,
Gary -
How can i declare a selection screen in a DP program with transaction code.
hi friends,
How can i declare a selection screen in a DP program with transaction code. What are the events and flow logic..Search in SCN/Google for Module-pool programming basics.
-
hi good morning,
I'm from malaysia,
can I use apple education package
my wife is a teacher,
I'm interested for mac 13 inch water for her
I be able to buy used apple education package
how and what documents are neededYou will need to contact th Apple Store. This is a user to user forum.
http://www.apple.com/contact/
http://store.apple.com/us-hed
Maybe you are looking for
-
One itunes account for many phones
Hello, We are currently deploying iphones within our business and I need to know how best to install some apps on all phones. As you need an itunes account to download apps (free ones) is there a way to have one account (for the business) and this al
-
Nokia Lumia 520 - Screen Cracked, Touch Screen not...
The other day I accidentaly dropped my 520 in the street. The screen has a large thin crack from the top left corner to about the middle right of the screen. I can live with the crack, it's barely noticable, as it looks like a hair on the screen. How
-
Hi all, I have developed a form with Screen Painter. In a field I attached an FMS. Although the FMS works perfect when I choose the value it is not paste in the specific field. Any Idea, Thanks in advance, Vangelis
-
Presenter publishing causes multiple duplicate slides
I am making edits and additions to a Presenter-enhanced PPT file that was created by someone else (I have the original PPCX file and audio files as well.) After making my edits, adding some new quiz questions and adding a few bits of additional audio
-
Help on Web Dispatcher: Urgent
Hi All, I have installed a web dispatcher 7. I am not able to configure it for my Portal server. In the profile file message server host and port properties are fine. Can somebody tell me what i am doing wrong. This is very urgent. Please reply ASAP