Home » SQL & PL/SQL » SQL & PL/SQL » source does not have a runnable target (oracle 11g,w7)
source does not have a runnable target [message #572907] Tue, 18 December 2012 09:40 Go to next message
oracle_doubt
Messages: 96
Registered: December 2012
Location: CHENNAI
Member
Dear friends,
While i am trying to execute this proc,i am facing source does not have a runnable target issue.Please help me.
Embarassed

CREATE OR REPLACE
PROCEDURE GET_CHILDS_SUB
( nid IN VARCHAR2
) AS
n varchar2;
CURSOR cur is SELECT node_id FROM test_tbl WHERE parent_id = nid;
BEGIN

OPEN cur;

LOOP

FETCH cur INTO n;

EXIT WHEN cur%notfound;

INSERT INTO childs VALUES ( n );

CALL get_childs_sub(n);

END LOOP;

CLOSE cur;

END GET_CHILDS_SUB;


Thanks & Regards
Siraj.j
Re: source does not have a runnable target [message #572911 is a reply to message #572907] Tue, 18 December 2012 10:01 Go to previous messageGo to next message
BlackSwan
Messages: 21940
Registered: January 2009
Senior Member
Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/
Re: source does not have a runnable target [message #572912 is a reply to message #572911] Tue, 18 December 2012 10:06 Go to previous messageGo to next message
oracle_doubt
Messages: 96
Registered: December 2012
Location: CHENNAI
Member
Hi,
I am not able to understand your mail.please do needfull.
Re: source does not have a runnable target [message #572915 is a reply to message #572907] Tue, 18 December 2012 10:12 Go to previous messageGo to next message
Michel Cadot
Messages: 57607
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
From your previous topic:

Michel Cadot wrote on Tue, 18 December 2012 17:10
...And to be clearer than BlackSwan as the last time you answered her "I am not able to understand your mail" and paraphrasing the link:

With any SQL or PL/SQL question, please, Post a working Test case: create table and insert statements along with the result you want with these data then we will be able work with your table and data. Explain with words and sentences the rules that lead to this result.

Before, Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version, with 4 decimals.

Use SQL*Plus and copy and paste your session, the WHOLE session.

In the end FEEDBACK to those that help you, we are waiting for you in your previous topics.

Regards
Michel

[Updated on: Tue, 18 December 2012 10:13]

Report message to a moderator

Re: source does not have a runnable target [message #572919 is a reply to message #572907] Tue, 18 December 2012 11:11 Go to previous messageGo to next message
cookiemonster
Messages: 10573
Registered: September 2008
Location: Rainy Manchester
Senior Member
1) This
siraj.accet@gmail.com wrote on Tue, 18 December 2012 15:40
i am facing source does not have a runnable target issue

Is not a valid oracle error message.
2) The code should be in code tags as Michel and Blackswan asked.
3) The posted code won't compile.
Re: source does not have a runnable target [message #572922 is a reply to message #572919] Tue, 18 December 2012 13:02 Go to previous messageGo to next message
Littlefoot
Messages: 18824
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
What happens if you substitute
CALL get_childs_sub(n);
with
get_childs_sub(n);
(i.e. omit the "CALL")?
Re: source does not have a runnable target [message #572956 is a reply to message #572922] Tue, 18 December 2012 23:39 Go to previous messageGo to next message
oracle_doubt
Messages: 96
Registered: December 2012
Location: CHENNAI
Member
Hi,
I have removed call from proc.But still it is compiling with errors../fa/10564/0/
  • Attachment: Untitled1.png
    (Size: 14.27KB, Downloaded 708 times)
Re: source does not have a runnable target [message #572961 is a reply to message #572956] Wed, 19 December 2012 00:57 Go to previous messageGo to next message
Littlefoot
Messages: 18824
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
n varchar2;
is not valid. Should be
n test_tbl.node_id%type;
or
n varchar2(20); -- or 30, or whatever NODE_ID's size is
or 
n cur%rowtpye;
Re: source does not have a runnable target [message #572966 is a reply to message #572956] Wed, 19 December 2012 01:25 Go to previous messageGo to next message
Michel Cadot
Messages: 57607
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Do NOT post images for code, post it in text, inline, no attached file.
We cannot copy and paste an image into SQL*Plus.

Regards
Michel
Re: source does not have a runnable target [message #572980 is a reply to message #572966] Wed, 19 December 2012 02:54 Go to previous messageGo to next message
cookiemonster
Messages: 10573
Registered: September 2008
Location: Rainy Manchester
Senior Member
We also need the error messages.
Even if it did compile for you it wouldn't for us as we don't have your tables.
Re: source does not have a runnable target [message #573112 is a reply to message #572980] Fri, 21 December 2012 00:44 Go to previous messageGo to next message
oracle_doubt
Messages: 96
Registered: December 2012
Location: CHENNAI
Member
Hi all,
Please do needfull

create or replace
PROCEDURE GET_CHILDS
( nid IN VARCHAR2
) AS
BEGIN
DECLARE n INT;

DROP TEMPORARY TABLE IF EXISTS childs;
CREATE TEMPORARY TABLE childs (
node_id INT NOT NULL PRIMARY KEY
);

/* check if there really are sub-nodes */
SELECT COUNT(*)
FROM test_tbl
WHERE parent_id = nid INTO n;

IF n <> 0 THEN
/* fetch the node_ids of the childs
into the __childs table */
CALL get_childs_sub(nid);
END IF;

SELECT t1.*
FROM test_tbl AS t1, childs USING(node_id);

END GET_CHILDS;


create or replace
PROCEDURE GET_CHILDS_SUB
(nid IN VARCHAR2)AS
n varchar2(20);
CURSOR cur is select node_id from test_tbl where parent_id=nid;
BEGIN
OPEN cur;
LOOP
FETCH cur INTO n;
EXIT WHEN cur%notfound;
INSERT INTO childs VALUES(n);
get_childs_sub(n);
END LOOP;
CLOSE cur;
END GET_CHILDS_SUB;


Error(8,3): PLS-00103: Encountered the symbol "DROP" when expecting one of the following: begin function pragma procedure subtype type <an identifier> <a double-quoted delimited-identifier> current cursor delete exists prior
Re: source does not have a runnable target [message #573113 is a reply to message #573112] Fri, 21 December 2012 00:48 Go to previous messageGo to next message
Littlefoot
Messages: 18824
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You can't do DDL in PL/SQL (unless you use dynamic SQL). Besides, syntax you posted is not valid Oracle syntax (drop if exists?!?). Are you sure you use Oracle?
Re: source does not have a runnable target [message #573114 is a reply to message #573113] Fri, 21 December 2012 00:54 Go to previous messageGo to next message
oracle_doubt
Messages: 96
Registered: December 2012
Location: CHENNAI
Member
Hi,
I am familiar in MySql but i am new to oracle.So please guide me.
Re: source does not have a runnable target [message #573115 is a reply to message #573114] Fri, 21 December 2012 00:56 Go to previous messageGo to next message
oracle_doubt
Messages: 96
Registered: December 2012
Location: CHENNAI
Member
Hi,
MySql will support DDL IN proc.So i have tried like this.
Re: source does not have a runnable target [message #573116 is a reply to message #573115] Fri, 21 December 2012 01:08 Go to previous message
Littlefoot
Messages: 18824
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I don't know WHERE should I (we) guide you. I don't know what you have and what you'd want to get as a result.

I also believe that it is in vain to code the way you do - posting this code and that code, none of them being valid. Perhaps you should learn syntax first, then move on to actual coding. Have a look at Oracle 10g documentation page (yes, I know, you're on 11g, but the one I posted has it nicely sorted) - pay attention to the "Most popular" section, its PL/SQL User's Guide and Reference, Application Developer's Guide - Fundamentals and SQL Reference books. It'll take some time to read them, but once you're done with it, you should be capable of coding what you need.
Previous Topic: Explain plan : different for both tables
Next Topic: Compare last price of the day and present price
Goto Forum:
  


Current Time: Thu Apr 17 15:28:26 CDT 2014

Total time taken to generate the page: 0.07386 seconds