Creating Procedure in SQL Developer 3
CREATE OR REPLACE PROCEDURE INSERTION_MAIN_2_SP
AS
MID NUMBER;
BEGIN
SELECT SEQ_ID.NEXTVAL INTO MID FROM DUAL;
INSERT INTO MASTER_TB VALUES(MID,'AKBER','HYDERABAD','INDIA');
INSERT INTO DETAIL VALUES(SEQ_DETAIL.NEXTVAL,MID,SYSDATE,2,600,1);
INSERT INTO DETAIL VALUES(SEQ_DETAIL.NEXTVAL,MID,SYSDATE,2,600,1);
INSERT INTO DETAIL VALUES(SEQ_DETAIL.NEXTVAL,MID,SYSDATE,2,600,1);
INSERT INTO DETAIL VALUES(SEQ_DETAIL.NEXTVAL,MID,SYSDATE,2,600,1);
INSERT INTO DETAIL VALUES(SEQ_DETAIL.NEXTVAL,MID,SYSDATE,2,600,1);
INSERT INTO DETAIL VALUES(SEQ_DETAIL.NEXTVAL,MID,SYSDATE,2,600,1);
INSERT INTO DETAIL VALUES(SEQ_DETAIL.NEXTVAL,MID,SYSDATE,2,600,1);
INSERT INTO DETAIL VALUES(SEQ_DETAIL.NEXTVAL,MID,SYSDATE,2,700,1);
INSERT INTO DETAIL VALUES(SEQ_DETAIL.NEXTVAL,MID,SYSDATE,2,600,1);
INSERT INTO DETAIL VALUES(SEQ_DETAIL.NEXTVAL,MID,SYSDATE,2,600,1);
INSERT INTO DETAIL VALUES(SEQ_DETAIL.NEXTVAL,MID,SYSDATE,2,600,1);
INSERT INTO DETAIL VALUES(SEQ_DETAIL.NEXTVAL,MID,SYSDATE,2,600,1);
INSERT INTO DETAIL VALUES(SEQ_DETAIL.NEXTVAL,MID,SYSDATE,2,300,1);
INSERT INTO DETAIL VALUES(SEQ_DETAIL.NEXTVAL,MID,SYSDATE,2,600,1);
INSERT INTO DETAIL VALUES(SEQ_DETAIL.NEXTVAL,MID,SYSDATE,2,600,1);
INSERT INTO DETAIL VALUES(SEQ_DETAIL.NEXTVAL,MID,SYSDATE,2,600,1);
INSERT INTO DETAIL VALUES(SEQ_DETAIL.NEXTVAL,MID,SYSDATE,2,200,1);
INSERT INTO DETAIL VALUES(SEQ_DETAIL.NEXTVAL,MID,SYSDATE,2,600,1);
INSERT INTO DETAIL VALUES(SEQ_DETAIL.NEXTVAL,MID,SYSDATE,2,600,1);
END INSERTION_MAIN_2_SP;
Recieving Error :
Error: ORA-06552: PL/SQL: Compilation unit analysis terminated ORA-06553: PLS-320: the declaration of the type of this expression is incomplete or malformed
Hi Asif,
If the sequences (seq_id, seq_detail) and tables (master_tb, detail) are in the connection's schema and defined with columns having the data types indicated in your code, then the DDL does compile in SQL Developer 3.0.
Recall that privileges acquired via ROLE do not apply within PL/SQL procedures, so perhaps that is your problem. Otherwise make sure the data values in the INSERT statements map properly to the underlying column ordering in the tables.
Regards,
Gary Graham
SQL Developer Team
Similar Messages
-
How run Procedure in SQL Developer?
I need run procedure in SQL Developer with parameter : 2009
create or replace PROCEDURE "update_table" (ff_year in varchar2) AS
CURSOR c_update IS
select DISTINCT P.mafew name, u.frew nameone, t.greddf, .........
I click green button RUN and have new window Run PL/SQL. Where in this script I need to print 2009?
DECLARE
FF_YEAR VARCHAR2(200);
BEGIN
FF_YEAR := NULL;
update_table(
FF_YEAR => FF_YEAR
END;Hi,
user10886774 wrote:
Thanks all!
I can run the procedure like 1 or 2 example? Is it right?
1 like Run Script
EXEC "UPDATE_TABLE" ('2009');
2 click RUN on UPDATE_TABLE procedure
DECLARE
FF_YEAR VARCHAR2(200);
BEGIN
FF_YEAR := '2009';
UPDATE_TABLE(
FF_YEAR => FF_YEAR
END;
What is the name of the procedure?
Is it update_tabe (all small letters)? If so, you must reference it as "update_table" (all small letters, inside double-quotes).
Is it UPDATE_TABLE (all capital letters)? If so, you have the choice of referencing it as "UPDATE_TABLE" (all capital letters, inside double-quotes) or as update_table, or Update_Table, or UPDATE_TABLE, or uPdAtE_taBle, or ... (any kind of letters, without quotes).
How about commit after?How about it?
What is the question?
If you want to commit, say COMMIT or click on the COMMIT icon. -
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. -
Executing Procedures in sql Developer
Hi ,
I'm new to SQL Developer and trying to explore the tool . I have written a procedure as
create or replace PROCEDURE SAMPLE2 AS
studName Varchar2(8) ;
BEGIN
SELECT Stud1.NAME INTO studName
FROM Stud1
WHERE Stud1.NAME = 'SOM';
END ;
It has compiled perfectly .
Now when I run by right clicking it works
But when I'm running it using
BEGIN
exec SAMPLE2()
END;
or
BEGIN
SAMPLE2()
END;
it is giving error .
Morover can you tell me how I can view the data after running the procedure .See Executing Anonymous Blocks in SQL Developer
Remember statements always need to end with ;
Regards,
K. -
Run package store procedure in sql developer
Night staff, I am using Oracle 11g, only that it gives the following error below, which can be wrong and how to rotate within the sql developer?
Warning(3,18): PLW-07203: o parâmetro 'CODCEP_EMP' pode se beneficiar do uso da hint do compilador NOCOPY
ror starting at line 1 in command:
exec buscadb.tabemp('09811370');
Error report:
ORA-06550: linha 1, coluna 7:
PLS-00306: número incorreto de tipos de argumentos na chamada para 'TABEMP'
ORA-06550: linha 1, coluna 7:
PL/SQL: Statement ignored
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
create or replace PACKAGE BUSCADB AS
TYPE t_cursor IS REF CURSOR;
PROCEDURE TABEMP(CODCEP_EMP IN OUT empresas.cep_emp%TYPE,io_cursor OUT t_cursor);
END BUSCADB;
create or replace PACKAGE BODY BUSCADB AS
PROCEDURE TABEMP(CODCEP_EMP IN OUT empresas.cep_emp%TYPE,io_cursor OUT t_cursor) AS
v_cursor t_cursor;
begin
open v_cursor for
select cod_emp,nom_emp,end_emp,cep_emp
from empresas
where cep_emp = codcep_emp;
io_cursor := v_cursor;
END TABEMP;
END BUSCADB;These questions should be posted in the SQL And PL/SQL forum.
But I can give you this: READ the error. The procedure takes 2 parameters, you only give 1.
Regards,
K. -
How can I execute this procedure in sql developer, cursortype is refcursor
PROCEDURE GET_CNTRY(CNTRY_NME_IN IN VARCHAR2 DEFAULT NULL,
QRY_RSLT_OUT OUT CURSORTYPE) AS
BEGIN
OPEN QRY_RSLT_OUT FOR
select
CNTRY_NME,
FRGN_CNTRY_CDE,
INV_VEH_CNTRY_CDE,
FRGN_CNCY_CDE,
WTHH_PCT_COLA_CDE
FROM
CNTRY
WHERE
CNTRY_NME = NVL(CNTRY_NME_IN,CNTRY_NME);
END GET_CNTRY;In SQL Developer run the following code as script (You need to hit F5 to run it as script).
var rc refcursor
exec get_cntry (<give your cntry_nme_in>, :rc)
print :rc -
How to Execute SQL Server stored procedure through SQL Developer?
Hi,
I was successful in connecting SQL Server database using SQL Developer. I am able to see all the objects such Tables,Views & Procedure and also can query data using sql Query. But when it comes to executing procedure there's no option to achieve this. I tried "Exec |<Execute Procedure> Proc_name" but unfortunately both statement threw Errors.
Please suggest about other alternates.
Thanks in Advance,
APHi,
I was successful in connecting SQL Server database using SQL Developer. I am able to see all the objects such Tables,Views & Procedure and also can query data using sql Query. But when it comes to executing procedure there's no option to achieve this. I tried "Exec |<Execute Procedure> Proc_name" but unfortunately both statement threw Errors.
Please suggest about other alternates.
Thanks in Advance,
AP -
About creating functions in SQL Developer
I have successfully installed Oracle SQL Developer.Also I have got a book on Oracle SQL Developer by Dan Hotka.
After going through the book I could not a solution for creating and compiling functions without any errors.What errors?
How about going through the tutorial inside the online help (Help - Table of Contents - Tutorial)?
Have fun,
K. -
How to debug a procedure in SQL Developer
i am a plsql writer .... i use SQL Developer to connect to oracle on windows platform ... iam using oracle
version 10g some time i need to debug a procedure or i want to run a procedure in debug mode
please tell me how to do this SQL DeveloperThere's great help inside sqldev, just follow the Help Contents - Concepts and usage - Running and debugging...
Have fun,
K. -
Exporting procedures using sql developer
Hi,
I successfully migrated a mysql database to the oracle database using sql developer.All the data excluding procedures were moved to oracle.
I dont know why but none of the procedures were moved to oracle.
Now, i want to move those procedures to oracle database.Can you guys provide any help.11g.DBA wrote:
Hi,
I successfully migrated a mysql database to the oracle database using sql developer.All the data excluding procedures were moved to oracle.
I dont know why but none of the procedures were moved to oracle.
Now, i want to move those procedures to oracle database.Can you guys provide any help.If you want to do something, anything "with SQL Developer", the question would be best asked in the [url https://forums.oracle.com/forums/forum.jspa?forumID=260]SQL Developer forum -
Calling Procedure from SQL Developer
Could anyone tell me how to call a Procedure from a SQL Worksheet using SQL Developer?
I can run by right clicking the Procedure in the Connections window, but want to call it using SQL commands.
I can run it using EXECUTE procedurename in SQL Plus but I get an ORA-00900 - invalid SQL statement if I try this in a SQL Worksheet. If I try CALL procedurename, I get an ORA-06576 - not a valid procedure or function name.
Am I doing something daft (I've been using Oracle for 3 days)?begin
procedure(params);
end; -
Can't create connection in SQL developer
hi,
i download sql developer from oracle website but when i want to start and start it with making new connection it always give me error saying
test faild IO error: the network adapter could not estabilished a connection
please help
i am using windows vista 32bit OSHi Saqid,
If you performed a default Oracle 10g Express Edition installation on your local machine, then you should find something like the following:
Services:
OracleXEService Started Automatic
OracleXETNSListener Started Automatic
TNSNAMES.ORA file entry:
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
You should be able to do the following from a Windows command prompt and get similar results:
C:\>sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jul 25 14:53:17 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn system
Enter password:
Connected.
SQL>
SQL> quit
Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
C:\>
C:\>tnsping xe
TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 25-JUL-2011 14:22:35
Copyright (c) 1997, 2005, Oracle. All rights reserved.
Used parameter files:
C:\oraclexe\app\oracle\product\10.2.0\server\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)
(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE)))
OK (50 msec)
When your installation works correctly for these commands, then the SQL Developer connection should work as well. If not, please provide specific installation and machine details. But first you need to verify using sqlplus and tnsping that the 10g installation is working correctly. If not, then please post to the appropriate forum for help in that area.
Regards,
Gary Graham
SQL Developer Team -
SSRS - Oracle Stored procedure returns no data but does in SQL Developer Sudio
HI there,
Stored procedure returns no data when executed on the report but when i execute the stored procedure in Sql Developer it returns required rows.
Thanks for your help!Hi Simon,
When i test with simple query, i get the data.
For your convenience, my stored proc looks lyk :
PROCEDURE pr_REPORT_data(P_STARTDATE IN DATE, P_ENDDATE IN DATE, data_rows OUT T_CURSOR) AS
OPEN completed_Reinstatement FOR
SELECT
value1,.......value5
FROM table1
WHERE
To_Date(createdDate, 'YYYY/MM/DD') BETWEEN To_Date(P_STARTDATE, 'YYY/MM/DD') AND To_Date(P_ENDDATE, 'YYYY/MM/DD');
END pr_REPORT_data;
T_CURSOR is of type cursor which is declared on the package.
I'm assuming the problem is with date parameters, however i converted the date before passing to
WHERE clause. -
Question about creating a cloud connection to SQL Developer
Hi all!
I want to create a cloud connection on SQL Developer to Oracle cloud, but keep getting the following error (NOTE: I have the trial version. Also, I have replace the identity domain name with asterisks for the post) :
Connection to https://databasetrial1875-******.db.us1.oraclecloudapps.com refused
Additional Details:
oracle.dbtools.raptor.cloud.auth.AuthenticationFailedException: Connection to https://databasetrial1875-******.db.us1.oraclecloudapps.com refused
at oracle.dbtools.raptor.cloud.auth.basic.BasicAuthenticationEngine.doPost(BasicAuthenticationEngine.java:228)
at oracle.dbtools.raptor.cloud.auth.basic.BasicAuthenticationEngine.authenticate(BasicAuthenticationEngine.java:73)
at oracle.dbtools.raptor.cloud.connection.ConnectionCreator.createConnection(ConnectionCreator.java:24)
at oracle.dbtools.raptor.cloud.connection.CConnections$C.getConnection(CConnections.java:39)
at oracle.dbtools.raptor.cloud.connection.CConnections.getConnection(CConnections.java:176)
at oracle.dbtools.raptor.cloud.navigator.CloudConnection.openConnectionImpl(CloudConnection.java:127)
at oracle.dbtools.raptor.cloud.navigator.CloudConnection.getConnection(CloudConnection.java:89)
at oracle.dbtools.raptor.cloud.navigator.ConnectionTreeNode$LoadTask.doWork(ConnectionTreeNode.java:74)
at oracle.dbtools.raptor.cloud.navigator.ConnectionTreeNode$LoadTask.doWork(ConnectionTreeNode.java:38)
at oracle.dbtools.raptor.backgroundTask.RaptorTask.call(RaptorTask.java:193)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at oracle.dbtools.raptor.backgroundTask.RaptorTaskManager$RaptorFutureTask.run(RaptorTaskManager.java:554)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.apache.http.conn.HttpHostConnectException: Connection to https://databasetrial1875-******.db.us1.oraclecloudapps.com refused
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:158)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:149)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:121)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:561)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:415)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:941)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:919)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:910)
at oracle.dbtools.raptor.cloud.connection.DefaultClient.executeRequest(DefaultClient.java:90)
at oracle.dbtools.raptor.cloud.auth.basic.BasicAuthenticationEngine.doPost(BasicAuthenticationEngine.java:219)
... 16 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:618)
at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:375)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:148)
... 26 more
I have followed the steps to the last letter using: Data Loading and the Oracle Database Cloud Service
What I have done on the dashboard and APEX:
I changed the password of the SFTP user.
I have created a new user on APEX that belongs to the SQL Developer Group and changed the 'Require change on Password on First Use' to NO before creating the user
SQL Developer:
I set the database username to the new user I created in APEX
I set the database URL to the URL I used to reach the APEX page...https://databasetrial1875-******.db.us1.oraclecloudapps.com/apex/
I set the SFTP username to the username listed next to 'Service SFTP User Name' on the dashboard
I set the SFTP hostname to: sftp.us1.cloud.oracle.com
I left the port set to 22
When I login on SQL Developer to database, I use the password for the user I created in APEX
Thanks in advance to all who help!Hi,
You have to use the admin account to add the admin role to the developer account. Can you please try this and let me know of your feedback.
The settings you added look good, and the you have the latest version of Sql DEVELOPER , ...so this should be an issue.
Maybe you have some firewall setting on your computer, that are blocking the connection?
If , after checking all of the above you still have an issue, please contact oracle support via the chat on the cloud.oracle.com and ask the engineer to open a Service Request under your name.
Thanks,
Flori -
Executing procedure with IN OUT parameters using SQL developer
Hi, I'm trying to exceute the below procedure in SQL developer. Here the IN OUT cursor 'journal_cursor' is already defined.
PROCEDURE LIST_FORPROJECT (
p_project_sid IN NUMBER,
p_journal_cursor IN OUT journal_cursor,
AS
BEGIN
OPEN p_journal_cursor FOR
-- get the journal
SELECT j.JOURNAL_KEY AS "Journal_SID",
j.JOURNALTEXT AS "Entry",
j.CREATEDATE AS "CreateDate",
--j.COMMENT_ AS "Comment",
j.PROJECTPHASETASK_KEY AS "ProjectPhaseTaskSet_SID",
j.person_key AS "Person_SID"
FROM vdl_JOURNAL j
INNER JOIN vdl_PROJECTJOURNAL pj ON pj.JOURNAL_KEY = j.JOURNAL_KEY
WHERE pj.PROJECT_KEY = p_project_sid
ORDER BY j.CREATEDATE ASC, j.JOURNAL_KEY ASC;
END LIST_FORPROJECT;
When trying to run the above procedure through SQL developer, I get the below code generated.
DECLARE
P_PROJECT_SID NUMBER;
P_JOURNAL_CURSOR journal_cursor;
BEGIN
P_PROJECT_SID := 5974;
-- Modify the code to initialize the variable
-- P_JOURNAL_CURSOR := NULL;
-- Modify the code to initialize the variable
LIST_FORPROJECT(
P_PROJECT_SID => P_PROJECT_SID,
P_JOURNAL_CURSOR => P_JOURNAL_CURSOR,
-- Modify the code to output the variable
DBMS_OUTPUT.PUT_LINE('P_JOURNAL_CURSOR' || P_JOURNAL_CURSOR);
END;
But executing the above sql doesn't print the cursor as output but errors out saying 'wrong number or type or arguments in call to ||'. Can somebody please help me in finding a way test and view the results of such a procedure through SQL developer?
Any help is highly appreciated.
Regards,
RanganathHi,
I was able to solve the problem.. My cursor was declared like this.
TYPE journal_def IS RECORD
journal_sid NUMBER(10),
journaltext CLOB,
createdate DATE,
projectphasetaskset_sid NUMBER(10),
person_sid NUMBER(10)
TYPE journal_cursor IS REF CURSOR RETURN journal_def;
I used the journal_def type to fetch the records.
Here is how my final sql looked like.
DECLARE
P_PROJECT_SID NUMBER;
P_JOURNAL_CURSOR journal_cursor;
P_J_CURSOR journal_def;
BEGIN
P_PROJECT_SID := 11171;
-- Modify the code to initialize the variable
-- P_JOURNAL_CURSOR := NULL;
LIST_FORPROJECT(
P_PROJECT_SID => P_PROJECT_SID,
P_JOURNAL_CURSOR => P_JOURNAL_CURSOR,
-- Modify the code to output the variable
BEGIN
--open P_JOURNAL_CURSOR;
loop
fetch P_JOURNAL_CURSOR into P_J_CURSOR;
exit when P_JOURNAL_CURSOR%NOTFOUND;
DBMS_OUTPUT.put_line(P_J_CURSOR.journal_sid);
end loop;
--close P_JOURNAL_CURSOR;
END;
END;
This gave me results. Thanks a ton ALL for your help..... :)..
Regards,
Ranganath
Maybe you are looking for
-
Having trouble installing windows 8.
Tried putting windows 8 iso on flash drive from a pc and starting from there but it displays an error occurred while formatting the disk. please help. I bought windows 8 and thought it would be a relatively simple process to put the windows 8 iso on
-
Ipad suddenly can power off in two seconds
Hi My iPad mini retina, iOS 7.1. Started powering off ( I reboot my ipad periodically as a habit) way too fast. I hold down power until I get the slide to power off, and when I slide I get the spinning wheel for about a seconds then it shuts off.
-
How can I import the catalog elements_10 into elements_13?
Programm PS_Elements_13 ist correctly installed. There are several thousends of Fotos in the old catalog registered. I work with Windows7 and PC
-
MSS :- Problem in Organisation Chart
Hi, I hav got a prob in MSS.. When i click on Organisation Chart link.. It display some XML file..wot could be reason..could you pls suggest the solution to display organisation chart, Thanks
-
How to fetch data from request parameter in a session ?
Dear Experts, I have a scenario where I have accouting doc number stored in a table column, Could you please tell how to fetch this accounting doc number and save it in UserSessionData ?? What is the the syntax to do that ? Regards, Mamai.