Create trigger within PL/SQL
I have a procedure that creates a trigger. When I execute the procedure I get an error: ORA-01031, however, when I copy and paste the create trigger command, it executes and will create the trigger without any problems. What is causing the 'insufficient privileges' error when it attempts to create it within a procedure?
Here is the stream of commands SQLPlus that shows what I am getting:
SQL> CREATE OR REPLACE PROCEDURE prc_create_trigger
2 (Table_Name in varchar2)
3 IS
4 v_create_trigger VARCHAR2(4000);
5 BEGIN
6 v_create_trigger := 'CREATE OR REPLACE TRIGGER trg_pauls_table ';
7 v_create_trigger := v_create_trigger || 'AFTER INSERT ON ' || table_name || ' ';
8 v_create_trigger := v_create_trigger || 'REFERENCING NEW AS newrow OLD AS oldrow FOR EACH ROW ';
9 v_create_trigger := v_create_trigger || 'DECLARE ';
10 v_create_trigger := v_create_trigger || ' v_text varchar2(20);';
11 v_create_trigger := v_create_trigger || 'BEGIN';
12 v_create_trigger := v_create_trigger || ' v_text := ''Inserted Row'';';
13 v_create_trigger := v_create_trigger || ' dbms_output.put_line(v_text);';
14 v_create_trigger := v_create_trigger || 'END;';
15
16 DBMS_OUTPUT.put_line(v_create_trigger);
17
18 --
19 execute IMMEDIATE v_create_trigger;
20 END;
21 /
Procedure created.
SQL> exec prc_create_trigger('pauls_table');
CREATE OR REPLACE TRIGGER trg_pauls_table AFTER INSERT ON pauls_table
REFERENCING NEW AS newrow OLD AS oldrow FOR EACH ROW DECLARE v_text
varchar2(20);BEGIN v_text := 'Inserted Row';
dbms_output.put_line(v_text);END;
BEGIN prc_create_trigger('pauls_table'); END;
ERROR at line 1:
ORA-01031: insufficient privileges
ORA-06512: at "BAAN.PRC_CREATE_TRIGGER", line 20
ORA-06512: at line 1
SQL> CREATE OR REPLACE TRIGGER trg_pauls_table AFTER INSERT ON pauls_table
2 REFERENCING NEW AS newrow OLD AS oldrow FOR EACH ROW DECLARE v_text
3 varchar2(20);BEGIN v_text := 'Inserted Row';
4 dbms_output.put_line(v_text);END;
5 /
Trigger created.
I am wanting to do this because I need to create this trigger dynamically when a table has been created. This trigger is simply for testing the procedure.
Thank you for your assistance.
Paul
Why does the application need to drop and re-create tables in the first place? What is the purpose of this "re-org"? If it accomplishes anything useful, it's likely that there is some flaw in the application architecture/ design/ implementation that could be fixed once to remedy whatever problem this drop & rebuild option attempts to solve. If there really is a need to reorganize a table regularly, could the application at least be modified to use one of the various approaches Oracle provides for this sort of thing?
The "re-org" process you're describing is, at best, a hack. A trigger on the TABLES_TO_BE_REORGED table that creates triggers on whatever table name was deleted from this table is, at best, a hack. Layering one hack on top of another is likely to cause lots of pain.
For one thing, a trigger cannot commit. But DDL implicitly commits before and after the DDL is executed. So you cannot create a trigger within another trigger. You could have a trigger that creates a job that later runs and creates the new trigger, but that's adding an extra layer of asynchronisity to a problem that is already likely over-engineered. You could also declare the trigger that creates the trigger to be an autonomous transaction, but that would cause horrible problems if the re-org process ever were to encounter and exception and have to roll back.
Justin
Similar Messages
-
Multiple CREATE TRIGGER's in SQL file
I have an SQL file which contains multiple CREATE TRIGGER statements. I can't run it as it stands in SQLPlus Worksheet because it doesn't recognise the
end;
as the end of the create trigger statement and fails on the next CREATE line.
Is there a way I can get this file to process. I can run each statement individually, but there's a lot of them.
Any thoughts much appreciated.
Thanks in advance.Just for clarity within your file, you may want to do the following
Create or Replace Trigger TG_One
before insert on mytab_two
for each row
declare
adt_exists EXCEPTION;
begin
end TG_One ;
Create or Replace Trigger TG_Two
before insert on mytab_three
for each row
declare
adt_exists EXCEPTION;
begin
end TG_Two ; -
Create reports within pl/sql
I would like to create a report with all of the sorting capabilities that a standard wizard generated report has, but I'd like to define the columns within a PL/SQL procedure or function. My goal is to return a set of records and for each record concatenate multiple rows from a second set of records based on each unique value from the first. But I want to present the data on one line.
For example:
query1 results
col1 = 1, col2 = A
col1 = 2, col2 = B
query2 results
col1 = A, col2=testA1
col1 = A, col2=testA2
col1 = B, col2=testB1
col1 = B, col2=testB2
col1 = B, col2=testB3
report should look like
col1=1, col2=A, col3=testA1-testA2
col1=2, col2=B, col3=testB1-testB2-testB3I would suggest using the str2tbl function that Tom shows at http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:110612348061
and doing something like
select col1,col2,str2tbl(...)
from ...
group by col1,col2 -
Creating trigger with dbms_sql causes ORA-01912
I use the following procedure to execute statements that are stored in clobs. These statements are very long 'create trigger' statements.
SQL> create or replace procedure executeClob(clob_stmt in clob) is
2
3 n_size number := ceil(dbms_lob.getlength(clob_stmt) / 255);
4 n_counter number;
5
6 t_lines dbms_sql.varchar2s;
7 i_cursor integer := dbms_sql.open_cursor;
8 begin
9
10 for n_counter in 1..n_size loop
11 t_lines (n_counter) := to_char(substr(clob_stmt, 1 + 255 * (n_counter - 1), 255));
12 end loop;
13
14 dbms_sql.parse(i_cursor, t_lines, t_lines.FIRST, t_lines.LAST, false, DBMS_SQL.native);
15 dbms_sql.close_cursor(i_cursor);
16 end;
17 /Every time I call this procedure, I get the following error
ORA-01912: keyword ROW expected
ORA-06512: in "SYS.DBMS_SYS_SQL", Line 1485
ORA-06512: in "SYS.DBMS_SQL", Line 26
ORA-06512: in "NTSDEV6.EXECUTECLOB", Line 14
ORA-06512: in "NTSDEV6.CREATELOGTRIGGER", Line 150
Has anyone an idea what the heck is going on? I can't explain that ORA-01912.
Thanks for your help =)Herzal wrote:
yes, the create-statement works fine when I paste it directly into sql*plusWhen and how did you test that? - Before putting it into the clob of after splitting clob up into strings.
Have you tried writing out the contents of your collection before parsing it? - It sounds like a missing chr(10) after FOR EACH ROW
Regards
Peter -
Create trigger not audited when run from sql developer Version 3.2.20.09
Creating or editing a trigger is not being stored in the audit table when run from sql developer.
Here is a sample script to show the issue:
Grant Connect,create table,create trigger To testuser Identified By testuser;
create table testuser.testtab(t1 number);
Select Count(*) From Dba_Audit_Trail Where Owner='TESTUSER';
CREATE OR REPLACE TRIGGER testuser.testtab_bi_trg BEFORE
Insert
ON testuser.testtab FOR EACH ROW
begin
null;
end;
Select Count(*) From Dba_Audit_Trail Where Owner='TESTUSER';
drop user testuser cascade;
If I run the script from sql developer the CREATE TRIGGER statement does not get audited.
If I run the script from sql plus or All Arround Automations PL/SQL Developer the CREATE TRIGGER statement does get audited.
If I edit the trigger from sql developer the CREATE TRIGGER statement does not get audited.
If I edit the trigger from All Arround Automations PL/SQL Developer the CREATE TRIGGER statement does get audited.DoyleFreeman wrote:
Not sure what you mean by "perform the audit".
Have you tested my script? Does the "Select Count(*) From Dba_Audit_Trail Where Owner='TESTUSER';" increment by 1 after each of the ddl statements or only after the Create table statement.
Your question doesn't have ANYTHING to do with sql developer and should be posted in the Database General forum
https://forums.oracle.com/community/developer/english/oracle_database/general_questions
Yes - and it works just fine once you ENABLE AUDITING. Your scripIt does NOT include the statements or code used to ENABLE auditing and, specifically, enable auditing for triggers.
Auditing doesn't just 'happen'; you have to enable it and you have to specify any non-default auditing that you want to perform.
Have you read any of the extensive documentation about auditing to learn how to use it?
See the Database Security Guide
http://docs.oracle.com/cd/E11882_01/network.112/e16543/auditing.htm
Also see 'Auditing Functions, Procedures, Packages, and Triggers
http://docs.oracle.com/cd/E11882_01/network.112/e16543/auditing.htm#BCGBEAGC
And see the AUDIT statement in the SQL language doc for how to specify auditing of specific operations.
http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_4007.htm
Select count(*) From Dba_Audit_Trail Where (Owner='SCOTT' or username = 'SCOTT')
and action_name = 'CREATE TRIGGER';
COUNT(*)
0
audit create trigger by scott
CREATE OR REPLACE TRIGGER emp_copy_bi_trg BEFORE
Insert
ON emp_copy FOR EACH ROW
begin
null;
end;
Select count(*) From Dba_Audit_Trail Where (Owner='SCOTT' or username = 'SCOTT')
and action_name = 'CREATE TRIGGER';
COUNT(*)
1 -
Create Trigger (PK from Sequence) in SQL Developer 1.5.1
Hi all
I'm new to Oracle and am trying to create the equivalent of an autonumber field on a table using the Create Trigger (PK from Sequence) option (by right clicking on a table in SQL Developer).
I've set up a sequence called REQUESTID and when using the above option it generates the following SQL:
begin
execute immediate 'create or replace trigger AutoNumber '||
' before insert on "REQUEST" '||
' for each row '||
'begin '||
' if inserting then '||
' if :NEW."REQUESTID" is null then '||
' select REQUESTID.nextval into :NEW."REQUESTID" from dual; '||
' end if; '||
' end if; '||
'end;';
end;
When I click Apply I get an ORA-00942 (table or view does not exist). Am I doing something daft here?Never mind - sorted it - I created the table under a different Schema to the System login being used in SQL Developer and so didn't have the permissions to create the trigger on the table.
-
Sql to see the definition of an created trigger
Hy, what sql to use to see the entire definition of an already created trigger of a table?
ThanksDBMS_METADATA package: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_metada.htm#ARPLS026
SQL> create or replace trigger emp_trg
2 before insert
3 on emp
4 for each row
5 begin
6 null;
7 end;
8 /
Trigger created.
SQL> select dbms_metadata.get_ddl('TRIGGER', 'EMP_TRG') from dual;
DBMS_METADATA.GET_DDL('TRIGGER','EMP_TRG')
CREATE OR REPLACE TRIGGER "HOEK"."EMP_TRG"
before insert
on emp
for each row
begin
null;
end;
ALTER TRIGGER "HOEK"."EMP_TRG" ENABLE
1 row selected. -
Tip in create trigger thru SQL Developer 1.5
I try to create trigger in SQL Developer, which simply delete all the related rows in other tables, the trigger is as below:
create or replace trigger delregion
after delete on regions
for each row
begin
delete from countries where region_id=:old.region_id;
end delregion;
when I test it and it throws the following error:
delete from hr.regions where region_id = 4;
ORA-04098: trigger 'HR.DELREGION' is invalid and failed re-validation.......
However, I try exactly the same trigger in the SQLPLUS command console, it works just fine.
Finally, I found out I should click the "Run Script" button instead of the "Execute Statement" button..... :-)
Edited by: user7253132 on Oct 26, 2009 3:47 PM
Edited by: user7253132 on Oct 26, 2009 3:49 PMSo it's working now? Then mark the question as answered...
K. -
Use of "DBA_OBJECTS" in "AFTER CREATE" Trigger
Hi,
We would like to store some extra information about our objects we have in the database. To do so we tought of the idea of creating a 'documenting' table containing an object_id that references to the object_id from the view dba_views.
Now we want to automatically create a new record in our documenting table when a new object is created, in the first stage this should only contain the object_id
To accomplish this we are using an 'AFTER CREATE' trigger, but when this trigger fires and the code searches for the new object_id in dba_objects, it does not return any records and generates an error. Likely because when the trigger is executed, the view is not yet updated?
create or replace
TRIGGER TRG_TEST
AFTER CREATE ON SCOTT.SCHEMA
DECLARE
tmp VARCHAR2(50);
BEGIN
dbms_output.put_line(ora_dict_obj_name);
select object_id
into tmp
from dba_objects
where object_name = ora_dict_obj_name;
dbms_output.put_line(tmp);
END;
Error report:
ORA-04088: Fout bij uitvoering van trigger 'SCOTT.TRG_TEST'.
ORA-01403: Geen gegevens gevonden.
ORA-06512: in regel 6
04088. 00000 - "error during execution of trigger '%s.%s'"
*Cause: A runtime error occurred during execution of a trigger.
*Action: Check the triggers which were involved in the operation.
It's in dutch, so I'll have a go at translating:
Error report:
ORA-04088: Exception while executing trigger 'SCOTT.TRG_TEST'.
ORA-01403: No data found
ORA-06512: in rule 6
04088. 00000 - "error during execution of trigger '%s.%s'"
*Cause: A runtime error occurred during execution of a trigger.
*Action: Check the triggers which were involved in the operation.
Does anyone have an idea of how I can accomplish what I'm trying to do here.. Or maybe something I'm doing wrong?
Thanks in advance!
DavyWhat is "ora_dict_obj_name" defined as?
Another option might be to setup a DBMS_SCHEDULER job to run the following insert
firstly though, create the following table ;
create document_table as (select * from dba_objects where rownum < 1)and then setup a DBMS_SCHEDULER job to run the following:
begin
insert into document_table
(select dbo.*
from dba_objects dbo
,document_Table dtb
where dbo.Object_ID = dtb.Object_ID(+)
and dtb.Object_ID is null);
commit;
exception
when others then
rollback;
-- log a message somewhere with the error, i.e. SQLERRM
end;
/Note, I specified all columns, but you'll probably specify explicitly which column you require, in which case the CREATE table would change as well.
Then you won't have a need for any trigger, and can better manage when you want your documentation to be updated.
Another option might be to use COMMENT, which can be used on tables, views, materialized views, but won't cover all objects
to the extent you might want.
SQL> desc emp2
Name
EMPNO
JOB
START_DATE
SAL
DEPT
END_DATE
SQL> comment on column emp2.sal is 'Existing Salary of employee as paid at most recent month end'; -
Execute create trigger script in a procedure
Is it possible to create a trigger with pl/sql?
I have made a procedure thats makes the create or replace trigger statement.
(when i copy and past the statement the trigger is created succesvol)
How can i execute the create trigger statement on the end of the procedure?
Thanks.Well, then proceed with dynamic SQL.
Or, in my opinion much better: produce a SQL script with variables for table name and trigger name.
Then run this script with the appropriate values every time you have created a table.
Cheers,
Guido
Edited by: Guido on Oct 22, 2008 10:30 AM -
Please trace what is wrong in TRIGGER script , doesnt create trigger.
Hi Oracle Gurus,
Please help me, in finding what is wrong in trigger statement. It doesn not create trigger, instead it displays line numbers..like 1 2 3 4 ....after pressing the enter key,
I am attaching the full script, where it alters table, then creates new table, the creates sequence..lastly it fails in creating the trigger.
==================================================================================
SQL> ALTER TABLE MOBILE.MOBILE_USER ADD (LAST_LOGIN TIMESTAMP);
Table altered.
SQL> CREATE TABLE "MOBILE"."AUDIT_LOG"
2 3 "AUDIT_LOG_ID" NUMBER(16,0) NOT NULL ENABLE,
4 "DATE_CREATED" TIMESTAMP (6) NOT NULL ENABLE,
5 "AUDIT_TYPE" VARCHAR2(20 BYTE) NOT NULL ENABLE,
6 "AUDIT_DATA" CLOB,
7 CONSTRAINT "AUDIT_LOG_PK" PRIMARY KEY ("AUDIT_LOG_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "SERVICES_DATA" ENABLE
8 )
9 PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
10 11 12 )
TABLESPACE "SERVICES_DATA" LOB
13 14 (
15 "AUDIT_DATA"
16 )
17 STORE AS
18 (
19 TABLESPACE "SERVICES_DATA" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10 NOCACHE LOGGING STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
20 ) ;
Table created.
SQL> CREATE SEQUENCE "MOBILE"."AUDIT_LOG_SEQ" INCREMENT BY 1 START WITH 1000 CACHE 20 NOCYCLE ;
Sequence created.
SQL> create or replace
TRIGGER "MOBILE"."AUDIT_LOG_TRGR" before
INSERT ON "AUDIT_LOG" FOR EACH row BEGIN IF inserting THEN IF :NEW."AUDIT_LOG_ID" IS NULL THEN
SELECT AUDIT_LOG_SEQ.nextval
INTO :NEW."AUDIT_LOG_ID"
FROM dual;
END IF;
END IF;
END;Ok great..but it gives the same error, we have already checked that AUDIT_LOG does exist.
Is it checking something else..or it shoud be INSERT INTO instead of INSERT ON.
Please help.
create or replace
TRIGGER "MOBILE"."AUDIT_LOG_TRGR" before
INSERT ON "AUDIT_LOG" FOR EACH row BEGIN IF inserting THEN IF :NEW."AUDIT_LOG_ID" IS NULL THEN
SELECT AUDIT_LOG_SEQ.nextval
INTO :NEW."AUDIT_LOG_ID"
FROM dual;
END IF;
END IF;
END; /
INSERT ON "AUDIT_LOG" FOR EACH row BEGIN IF inserting THEN IF :NEW."AUDIT_LOG_ID" IS NULL THEN
ERROR at line 3:
ORA-00942: table or view does not exist -
Error while create trigger on for nested table
I want to insert a record into a nested table.For this, I created a view for the table, which includes the nested table.It told me ORA-25015 cannot perform DML on this nested table view column.So I created a trigger for the nested table.However, it told me that ORA-25010 Invalid nested table column name in nested table clause.I think my nested table is valid, i don't konw why did it appear this kind of problem?
My table is
CREATE TABLE ENT
ID NUMBER(7) NOT NULL,
CREATE_DATE VARCHAR2(11 BYTE),
UPDATE_DATE VARCHAR2(11 BYTE),
DEPTS VARRAY_DEPT_SEQ
CREATE OR REPLACE
TYPE DEPT AS OBJECT
ID NUMBER(8),
ANCHOR VARCHAR2(20),
CREATE OR REPLACE
TYPE " VARRAY_DEPT_SEQ" as varray(930) of DEPT
CREATE OR REPLACE VIEW ENT_NESTED_VIEW
(ID, CREATE_DATE, UPDATE_DATE, DEPTS)
AS
select e.ID,cast(multiset(select r.id,r.anchor from ent z, table(z.depts) r where z.ID=e.ID )as varray_dept_seq)
FROM ENT e
Then when I created trigger;
CREATE OR REPLACE TRIGGER EMP.ENT_NESTED_TRI
INSTEAD OF INSERT
ON NESTED TABLE DEPTS OF EMP.ENT_NESTED_VIEW
REFERENCING NEW AS New OLD AS Old PARENT AS Parent
FOR EACH ROW
BEGIN
END ;
I met the problem: ORA-25010 Invalid nested table column name in nested table clause
Could you please tell me the reason
Thank you!
My insert SQL is:
insert into table(select depts from ent_nested_view where id=1856) values(varray_dept_seq(dept(255687,'AF58743')))
Message was edited by:
user589751Hi,TongucY
Compared with the "Referencing Clause with Nested Tables" part of this reference -
http://psoug.org/reference/instead_of_trigger.html, I found the answer of this
quesion. That is "CREATE OR REPLACE TYPE " VARRAY_DEPT_SEQ" as[b] varray(930) of
DEPT". It turns to be a varying array, not a nested table. It should be "CREATE OR
REPLACE TYPE " VARRAY_DEPT_SEQ" as table of DEPT". That is OK. Thank you very
much!
While there is an another question, if I create a varying array like" CREATE OR
REPLACE TYPE " VARRAY_DEPT_SEQ" as[b] varray(930) of DEPT " and I want to insert
a record into the varying array, which the record has been existed.The method that
create a view and a trigger seems not to be effective.
For instance,
There is a record in the table
ID:1020
CREATE_DATE:2005-10-20
UPDATE_DATE:2007-2-11
DETPS: ((10225,AMY))
I want to ask this record to be
ID:1020
CREATE_DATE:2005-10-20
UPDATE_DATE:2007-2-11
DETPS: ((10225,AMY),(10558,TOM))
How should I do?
Could you please help me?
Best regards.
Message was edited by:
user589751 -
I create trigger but not display massage after insert in oracle 10g
I create trigger but not display massage after insert in oracle 10g
**CREATE OR REPLACE TRIGGER TableName**
**AFTER INSERT OR DELETE OR UPDATE ON test**
**BEGIN**
**if inserting then**
**dbms_output.put('Message');**
**end if;**
**END;**What user interface are you using?
If the tool doesn't support the SQL*Plus syntax (set serveroutput on), it probably has an option somewhere to enable DBMS Output. Not even knowing what tool you're using, it's impossible for us to guess where that option might be configured.
As others have suggested, using DBMS Output to test code is less than ideal because you're dependent on the application you're using to display it to you and not every application can or will do that. If you want to use DBMS_Output, you may need to switch to a different GUI (SQL Developer or SQL*Plus are both free utilities from Oracle). Otherwise, you'd probably be better off having the trigger do something that you can subsequently query (i.e. write a row to a log table).
Justin -
SEQUENCE Select within an SQL Query with an ORDER BY statement
Does anyone know why you cannot use an ORDER BY statement within an SQL query when also selecting from a SEQUENCE? My query was selecting production data as a result of a filtered search. I want to take the results of the filtered search and create a transaction. I have a sequence for generating transaction numbers where I select NEXTVAL. Since I could possibly obtain multiple, yet distinct, rows based upon my search criteria, I wanted to use an ORDER BY statement to simplify and order the resulting row(s).
I was able to get the SQL select with SEQUENCE.NEXTVAL to work without the ORDER BY, so I know that my SQL is correct. Thanks in-advance.Okay,
I understand. You want the sequence assigned first and the you want to ORDER BY. You
can do this using pipelined functions. See here:
CREATE OR REPLACE TYPE emp_rec_seq AS OBJECT (
seq NUMBER,
ename VARCHAR2 (20),
job VARCHAR2 (20),
sal NUMBER
CREATE OR REPLACE TYPE emp_tab_seq AS TABLE OF emp_rec_seq;
CREATE OR REPLACE FUNCTION get_emp_with_sequence
RETURN emp_tab_seq PIPELINED
IS
my_record emp_rec_seq := emp_rec_seq (NULL, NULL, NULL, NULL);
BEGIN
FOR c IN (SELECT dummy.NEXTVAL seq, ename, job, sal
FROM emp)
LOOP
my_record.seq := c.seq;
my_record.ename := c.ename;
my_record.job := c.job;
my_record.sal := c.sal;
PIPE ROW (my_record);
END LOOP;
RETURN;
END get_emp_with_sequence;after that, you can do a select like this:
SELECT seq, ename, job, sal
FROM TABLE (get_emp_with_sequence)
order by enamewhich will get you this:
SEQ ENAME JOB SAL
1053 BLAKE MANAGER 2850
1054 CLARK MANAGER 2450
1057 FORD ANALYST 3000
1062 JAMES CLERK 950
1055 JONES MANAGER 2975
1052 KING MANAGER 20000
1060 MARTIN SALESMAN 1250
1063 MILLER CLERK 1300
1064 DKUBICEK MANAGER 12000
1056 SCOTT ANALYST 3000
1058 SMITH CLERK 800
1061 TURNER SALESMAN 1500
1059 WARD SALESMAN 1250Denes Kubicek
http://deneskubicek.blogspot.com/
http://htmldb.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------- -
How to create save actions in SQL Developer 1.5?
Hi,
I am trying to create a save action in SQL Developer, which shall execute "an external tool" I already added.
I choose "Code-Editor" -> "save actions". I want to add an action, but there are 3 predefined actions and there is no possibility for me to add another. Is there a way for me to add a save action, as it is possible in eclipse?
What I am trying to do is, I want to trigger an external sql formatter. The sql formatter, which is built in, doesn't fit my needs and the way I can configure it, is very sparse. Therefore I want to use an external tool do to this - and I want it to be executed after saving the document.
Greetings,
DanielRight click on the table and select "Export Data": default format is INSERT statement.
Example of generated SQL:
-- Fichier créé - mardi-septembre-13-2011
-- DDL for Table HELP
CREATE TABLE "SYSTEM"."HELP"
( "TOPIC" VARCHAR2(50 BYTE),
"SEQ" NUMBER,
"INFO" VARCHAR2(80 BYTE)
) PCTFREE 0 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 49152 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "SYSTEM" ;
REM INSERTING into SYSTEM.HELP
Insert into SYSTEM.HELP (TOPIC,SEQ,INFO) values ('@',1,null);
Insert into SYSTEM.HELP (TOPIC,SEQ,INFO) values ('@',2,' @ ("at" sign)');
Insert into SYSTEM.HELP (TOPIC,SEQ,INFO) values ('@',3,' -------------');
Insert into SYSTEM.HELP (TOPIC,SEQ,INFO) values ('@',4,' Runs the SQL*Plus statements in the specified script. The script can be');
Insert into SYSTEM.HELP (TOPIC,SEQ,INFO) values ('@',5,' called from the local file system or a web server.');
Insert into SYSTEM.HELP (TOPIC,SEQ,INFO) values ('@',6,null);
Insert into SYSTEM.HELP (TOPIC,SEQ,INFO) values ('@',7,' @ {url|file_name[.ext]} [arg ...]');
Insert into SYSTEM.HELP (TOPIC,SEQ,INFO) values ('@',8,null);
Insert into SYSTEM.HELP (TOPIC,SEQ,INFO) values ('@',9,' where url supports HTTP and FTP protocols in the form:');
Insert into SYSTEM.HELP (TOPIC,SEQ,INFO) values ('@',10,null);
(...)SQL Developer documentation: http://download.oracle.com/docs/cd/E18464_01/index.htm.
Edited by: P. Forstmann on 13 sept. 2011 21:27
Maybe you are looking for
-
HT201269 how to download music from my iphone4s to a pc
I am trying to download my music from my Iphone 4s to my new PC with windows 8. Any help with this would be greatly appreciated. I downloaded I-tunes to my PC and I cannot seem to find a way to import the music from my Iphone to the I tunes.
-
Is my hard disk fried?!?
I have a 2009 imac running Snow leopard. It was running ridiculously slow and stalling out on programs like crazy this morning, I had to force shut down several programs several times (usually Firefox or Photoshop - though I did relaunch Finder once
-
When I try to access some websites, I get a "cookie not supported" message
I first noticed that I couldn't click through on links from a website and now there are websites I can't access at all. I have tried clearing my cookies but that didn't fix the problem
-
How to rebuild Windows 7 start menu?
Having had a virus and removed it successfully I am left with an odd problem. The virus, amongst other things, seems to have altered the start menu removing the "pinned" programs which is not a problem but also removing the contents from the folders
-
TNS:listener does not currently know of service requested in connect
[Oracle 10g 10.1.0.2] TNS:listener does not currently know of service requested in connect hi, My system is Windows XP. Oracle 10g : 10.1.0.2.0 I can connect through sqlplus (and toad) with the following command: sqlplus scott/tiger / but I cannot co