Stored Procedure Help: Source does not have a runnable target

I'm an MS-SQL guy, so I'm fairly familiar with T-SQL syntax, but am having one heck of a time trying to take code I've written for SQL and transform it to work with Oracle.
Anyways, I'm using Oracle's SQL Developer, and I've got a stored procedure that calls the Alter Table statement and adds a column to it. I'm just trying to get this one to work before I move on to the other one's I have. I keep getting the message Source does not have a runnable target when I try running this command.
create or replace PROCEDURE rta_conv_addcolumn(rtatablename1 in varchar(20),
rtatablename2 in varchar(20),
rtacolumnname in varchar(256),
rtacolumninfo in varchar(256))
AS
DECLARE rtasql VARCHAR(4000);
BEGIN
IF EXISTS (SELECT * FROM user_tables WHERE table_name = rtatablename1)
AND NOT EXISTS (SELECT * FROM user_tab_columns WHERE column_name = rtacolumnname
AND table_name = rtatablename1)
AND NOT EXISTS (SELECT * FROM user_tab_columns WHERE column_name = rtacolumnname
AND table_name = rtatablename2)
Then rtasql:= 'ALTER TABLE ['+rtatablename2+'] ADD ' + rtacolumnname + ' ' + rtacolumninfo;
Execute (rtasql);
END rta_conv_addcolumn;
If I try compiling it I get the following messages, which don't make sense, since the syntax I'm using for declaring the input variables looks to be right.
Error(1,54): PLS-00103: Encountered the symbol "(" when expecting one of the following: := . ) , @ % default character The symbol ":=" was substituted for "(" to continue.
Error(2,29): PLS-00103: Encountered the symbol "(" when expecting one of the following: := . ) , @ % default character The symbol ":=" was substituted for "(" to continue.
Error(3,29): PLS-00103: Encountered the symbol "(" when expecting one of the following: := . ) , @ % default character The symbol ":=" was substituted for "(" to continue.
Error(4,29): PLS-00103: Encountered the symbol "(" when expecting one of the following: := . ) , @ % default character The symbol ":=" was substituted for "(" to continue.
Error(6,1): PLS-00103: Encountered the symbol "DECLARE" when expecting one of the following: begin function package pragma procedure subtype type use <an identifier> <a double-quoted delimited-identifier> form current cursor external language The symbol "begin" was substituted for "DECLARE" to continue.
Error(15,5): PLS-00103: Encountered the symbol "RTA_CONV_ADDCOLUMN" when expecting one of the following: if

What table you want to add the column to? rtatablename1 or rtatablename2? I assumed 1 for now.
I tried to preserve your code structure so you can familiarize with it.
This piece should work, but you need to make sure you validate the parameters you concatenate to your strings when you use dynamic SQL.
That's when SQL injection takes place: when you trust the parameters you are receiving and don't validate them.
Also remember that DDL statements execute an implicit commit. Any previous DML operations you have pending will be commited by
this EXECUTE IMMEDIATE call if it succeeds.
I'd recommend some reading at the Oracle docs regarding those topics and the invoker's vs definer's rights for procedures.
It basically means that as a default behaviour, the user running the procedure "borrows" the rights and privileges of the procedure owner,
and that guy is usually super-privileged.
http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10472/subprograms.htm#LNPLS00809
CREATE OR REPLACE PROCEDURE rta_conv_addcolumn
  rtatablename1 IN VARCHAR,
  rtatablename2 IN VARCHAR,
  rtacolumnname IN VARCHAR,
  rtacolumninfo IN VARCHAR
) AS
  rtasql VARCHAR(4000);
  v_count NUMBER;
BEGIN
  SELECT COUNT(*)
    INTO v_count
    FROM user_tables
   WHERE table_name = upper(rtatablename1)
         AND NOT EXISTS (SELECT *
                           FROM user_tab_columns
                          WHERE column_name = upper(rtacolumnname)
                                AND table_name = upper(rtatablename1))
         AND NOT EXISTS (SELECT *
                           FROM user_tab_columns
                          WHERE column_name = upper(rtacolumnname)
                                AND table_name = upper(rtatablename2));
  IF v_count > 0
  THEN
    -- is it to the rtablename1 or 2 you want to add this column to?
    rtasql := 'ALTER TABLE ' || rtatablename1 ||' ADD ' || rtacolumnname || ' ' || rtacolumninfo;
    EXECUTE IMMEDIATE rtasql;
  END IF;
END rta_conv_addcolumn;Edited by: fsitja on Dec 11, 2009 11:21 PM

Similar Messages

  • Source does not have a runnable target.

    I am just learning Stored Procedures. I have Oracle SQL Developer Version 1.5.1 loaded, going against 11G running on Ubuntu Linux.
    I try to build a very basic Stored Procedure:
    CREATE OR REPLACE
    PROCEDURE HR.TEST AS
    BEGIN
    Select * from hr.jobs
    NULL;
    END HR.TEST;
    I always receive the following error:
    Source does not have a runnable target
    I always post these question in the wrong area on this Forum, so go ahead and just direct me to the correct forum if applicable.
    Any ideas?
    Thanks Zach

    Ah, so Tom O'Neill was not writing about Oracle. The clue was in the title, "SQL Server Stored Procedures for Beginners". Easy to miss perhaps ;)
    This is a valid procedure:
    CREATE OR REPLACE PROCEDURE test
        ( p_salary       IN  jobs.min_salary%TYPE
        , p_out_results  OUT SYS_REFCURSOR )
    AS
    BEGIN
        OPEN p_out_results FOR
            SELECT *
            FROM   jobs
            WHERE  p_salary BETWEEN min_salary AND max_salary
            ORDER BY min_salary, max_salary, job_title;
    END test;Here's how you might call it from SQL*Plus:
    SQL> var results refcursor
    SQL> exec test(3000, :results)
    PL/SQL procedure successfully completed.
    SQL> print :results
    JOB_ID     JOB_TITLE                           MIN_SALARY MAX_SALARY
    ST_CLERK   Stock Clerk                               2000       5000
    PU_CLERK   Purchasing Clerk                          2500       5500
    SH_CLERK   Shipping Clerk                            2500       5500
    AD_ASST    Administration Assistant                  3000       6000
    4 rows selected.or if you prefer,
    SQL> set autoprint on
    SQL>
    SQL> exec test(3000, :results)
    PL/SQL procedure successfully completed.
    JOB_ID     JOB_TITLE                           MIN_SALARY MAX_SALARY
    ST_CLERK   Stock Clerk                               2000       5000
    PU_CLERK   Purchasing Clerk                          2500       5500
    SH_CLERK   Shipping Clerk                            2500       5500
    AD_ASST    Administration Assistant                  3000       6000
    4 rows selected.No idea how to call it from SQL Developer, sorry.

  • Stored Procedure with in param not working

    I have  a stored procedure that works  now I need to use an in Parameter . when I made modification now the stored proc says  "Source does not have a runnable target." I can't seem to figure out what is wrong wit it.
    using SQL developer  version 1.5.5
    here is the  stored proc
    CREATE OR REPLACE
    PROCEDURE STATEMENT_DOMESTIC_TEST
    ( s_date IN statement.statementdate%Type
    ) AS
    BEGIN
    INSERT INTO STATEMENT_DATA
                      (   STATEMENTNUMBER,
                          STATEMENTTOTAL,
                          STATEMENTDATE,
                          BALANCE_FORWARD,
                          CUSTID,
                          CUSTNAME,
                          STATEMENTPURCHASES,
                          STATEMENTPAYMENTS,
                          NOMAILNOPRINT,
                          SOLDTOCOUNTRYNAME,
                          CREDITZEROFLAG,
                          SOLDTOCOUNTRYCODE)
                SELECT  STATEMENTNUMBER,
                        STATEMENTTOTAL,
                        STATEMENTDATE,
                        BALANCE_FORWARD,
                        CUSTID,
                        CUSTNAME,
                        STATEMENTPURCHASES,
                        STATEMENTPAYMENTS,
                        NOMAILNOPRINT,
                        SOLDTOCOUNTRYNAME,
                        CREDITZEROFLAG,
                        SOLDTOCOUNTRYCODE
                            FROM  EROCKS.PS_JWF_STATEMENT
                                  WHERE (statementdate = s_date)and (STATEMENTTOTAL >0)
                                        and (SOLDTOCOUNTRYNAME is null or SOLDTOCOUNTRYNAME='US')
                                        and (TRIM(NOMAILNOPRINT) is null and NOMAILNOPRINT!='99');
    update STATEMENT_DATA H
                        set
                          ( H.REMTO_ZIP,
                            H.REMTO_CITY,
                            H.REMTO_STATE,
                            H.REMTO_MAILNAME,
                            H.REMTO_ADDR1,
                            H.REMTO_ADDR2,
                            H.REMTO_ADDR3,
                            H.SOLDTO_CITY,
                            H.SOLDTO_STATE,
                            H.SOLDTO_ZIP,
                            H.SOLDTO_ADDR1,
                            H.SOLDTO_ADDR2,
                            H.SOLDTO_ADDR3,
                            H.PHONE_PREFIX,
                            H.PHONE_NUMBER,
                            H.COMPANY_NUMBER,
                            H.STATEMENTMISC_CREDIT1,
                            H.STATEMENTMISC_CREDIT2)=
                      (SELECT J.REMTO_ZIP,
                              J.REMTO_CITY,
                              J.REMTO_STATE,
                              J.REMTO_MAILNAME,
                              J.REMTO_ADDR1,
                              J.REMTO__ADDR2,
                              J.REMTO_ADDR3,
                              J.SOLDTO_CITY,
                              J.SOLDTO_STATE,
                              J.SOLDTO_ZIP,
                              J.SOLDTO_ADDR1,
                              J.SOLDTO_ADDR2,
                              J.SOLDTO_ADDR3,
                              J.PHONE_PREFIX,
                              J.PHONE_NUMBER,
                              J.COMPANY_NUMBER,
                              J.STATEMENTMISC_CREDIT1,
                              J.STATEMENTMISC_CREDIT2
                              FROM STATEMENT_HEADER J
                                  WHERE  H.STATEMENTNUMBER= J.STATEMENTNUMBER);
    INSERT INTO EROCKS.STATEMENT_DATA_DETAILS
                      ( INVOICENUMBER,
                      STATEMENTNUMBER,
                      INVOICEDATE,
                      DOC_TYPE,
                      INVOICETOTAL,
                      PURCHASES,
                      PAYMENTS,
                      MISC_CREDIT1,
                      MISC_CREDIT2,
                      BUNUMBER,
                      BUNUMBER_RU,
                      REFERENCE_NUMBER,
                      DESCRIPTION, seq_number)
                        SELECT  H.INVOICENUMBER,
                                H.STATEMENTNUMBER,
                                H.INVOICEDATE,
                                H.DOC_TYPE,
                                H.INVOICETOTAL,
                                H.PURCHASES,
                                H.PAYMENTS,
                                H.MISC_CREDIT1,
                                H.MISC_CREDIT2,
                                H.BUNUMBER,
                                H.BUNUMBER_RU,
                                H.REFERENCE_NUMBER,
                                H.DESCRIPTION,
                                EROCKS.SEQ_STATEMENT.NEXTVAL
                        FROM STATEMENT  H
                            WHERE H.STATEMENTNUMBER IN
                                (SELECT STATEMENTNUMBER
                                    FROM STATEMENT_DOMESTIC);
    END STATEMENT_DOMESTIC_TEST;

    Hello,
    could it be, that you are not connected to a database? This is what the error message suggests.
    You cannot compile or execute a stored procedure without a database connection.
    Regards
    Marcus
    BTW: you should also consider to install a newer version of SQL Developer. The current version is 3.2.2

  • The Local section of the Yahoo front page is stuck on New York, and I'm unable to change it to my city. IE does not have this problem.

    The Local section of the Yahoo front page is stuck on New York as the default, and I'm unable to change it to my city using the normal procedure. IE does not have this problem. This is a new problem that has occurred with the latest version of Firefox. Since the same problem doesn't occur with IE, I've concluded that this is a Firefox issue and not a Yahoo issue. Please advise.

    Clear the cache and the cookies from sites that cause problems.
    "Clear the Cache":
    *Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Tools > Options > Privacy > Cookies: "Show Cookies"

  • How can I convert my Open Source document files into Word document files? I cannot download Pages since my Macbook Air does not have the most recent software.

    How can I convert my Open Source document files into Word document files? I cannot download Pages since my Macbook Air does not have the most recent software. I downloaded open office to my mac to try and save money. It worked well for a while. Now I get this pop-up message that asks me to "Reopen" and when I select the option, nothing happens. I cannot save my documents anymore and I cannot convert them to word. Help!

    dwb wrote:
    Does OpenOffice output Word documents by default or do you have to select it manually?
    You have 17 options to save as in Open Office, one of which is .doc  files,  yes it needs to be saved manually.
    You may be able to default to DOC, but have not tried same.
    Since Open Office is 99% same as Word, I use it, or Word, either one.  Open Office is a bit less buggy than Word 11'

  • Since I have Yosemite on my iMac I can't view PDF files in Safari anymore.  It keeps telling me to upgrade my Adobe Reader, but it is the latest version.  Please help?  I don't have this problem on my Macbook that does not have Yosemite installed.

    Since I have Yosemite on my iMac I can't view PDF files in Safari anymore.  It keeps telling me to upgrade my Adobe Reader, but it is the latest version.  Please help?  I don't have this problem on my Macbook that does not have Yosemite installed.

    Back up all data before making any changes. Please take each of the following steps until the problem is resolved.
    Step 1
    If Adobe Reader or Acrobat is installed, and the problem is just that you can't print or save PDF's displayed in Safari, you may be able to do so by moving the cursor to the the bottom edge of the page, somewhere near the middle. A black toolbar should appear under the cursor. Click the printer or disk icon.
    Step 2
    There should be a setting in its preferences of the Adobe application such as Display PDF in Browser. I don't use those applications myself, so I can't be more precise. Deselect that setting, if it's selected.
    Step 3
    If you get a message such as ""Adobe Reader blocked for this website," then from the Safari menu bar, select
              Safari ▹ Preferences... ▹ Security
    and check the box marked
              Allow Plug-ins
    Then click
              Manage Website Settings...
    and make any required changes to the security settings for the Adobe PDF plugin.
    Step 4
    Triple-click anywhere in the line of text below on this page to select it, the copy the selected text to the Clipboard by pressing the key combination command-C:
    /Library/Internet Plug-ins
    In the Finder, select
              Go ▹ Go to Folder
    from the menu bar, or press the key combination shift-command-G. Paste into the text box that opens by pressing command-V, then press return.
    From the folder that opens, move to the Trash any items that have "Adobe" or “PDF” in the name. You may be prompted for your login password. Then quit and relaunch Safari.
    Step 5
    The "Silverlight" web plugin distributed by Microsoft can interfere with PDF display in Safari, so you may need to remove it, if it's present. The same goes for a plugin called "iGetter," and perhaps others—I don't have a complete list. Don't remove Silverlight if you use the "Netflix" video-streaming service.
    Step 6
    Do as in Step 4 with this line:
    ~/Library/Internet Plug-ins
    If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari.

  • Output Column does not have a matching source column in the schema

    Hi Everyone,
                           Can you please help me in this. Already an ETL is loading the data from AS400 TO SQL server. I need to add a new
    column. In the Source (OLEDB source) am pulling the data from AS400 using ADO.NET connection manager.
    New column is added in AS400. To bring the new column from AS400, I added column name in the query in OLEDB source. Test connection is good. In the Source editor, when I click on preview it gives me the values of the new column and if I click on build
    new query also it gives me values for the new column.
    After mapping the columns and refreshing the data in OLEDB destination, I don't see any errors or warnings.
    But when I start executing the package it throws me the below error.
     Error: The output column  (4659) does not have a matching source column in the schema.
    [SSIS.Pipeline] Error: "component  (2861)" failed validation and returned validation status "VS_NEEDSNEWMETADATA".
    I need suggestion on this.
    Thanks
    Veeresh

    Hi Veeresh,
    As per my understanding, this error happens when the OLE DB Source component cannot find the corresponding source column in the database table. Possible reason is the the column name in the external database table has changed or
    the column has been removed.
    To verify this issue, please go to the Advanced Editor for OLE DB Source Input and Output Properties tab to see the External columns and Output columns. To fix it, please refresh the data or recreate the Source.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Tying to install itunes and I get error message "This file does not have a program associated with it for performing this action.  Please install a program, or if one is already installed, create an association in the Default Programs control panel.  Help

    am tTying to install itunes and I get error message "This file does not have a program associated with it for performing this action.  Please install a program, or if one is already installed, create an association in the Default Programs control panel. Can anyone help me?

    Hi,
    Here is a similar thread for your reference:
    There is no email program associated to perform the requested action. Please install an email program or, if one is already installed, create an association in the Default programs control panel
    http://social.technet.microsoft.com/Forums/en/w7itproappcompat/thread/036e3cf6-bff7-4ef2-bd0a-555cd2399ad4
    Hope this helps
    Vincent Wang
    TechNet Community Support

  • I just purchased the apple tv, i have an older tv that does not have an HDMI input.   is there a converter i can get because the itv only have an HDMI output ?  help.

    i just purchased the apple tv, i have an older tv that does not have an HDMI input.   is there a converter i can get because the itv only have an HDMI output ?  help.

    Welcome to the Apple Community.
    There are hardware converters that will convert HDMI to various other types of output, however there are some issues with doing so that you should be aware of.
    HDCP
    HDCP compliant converters will not allow you to watch HDCP protected content such as that from the iTunes Store. Non compliant converters exist but we cannot discuss them under the Terms of Use for these communities.
    Resolution and aspect ratio
    I'm not aware of any converters that will scale the output from the Apple TV, any TV or projector which is used will need to be widescreen and support resolutions of 720p.

  • TS3989 Mssage when opening Photo Stream on-"This file does not have a program associated with it for performing this action. Please install a program or, if one is already installed, create an association in the Default Programs control panel" Help!!!

    Mssage when opening Photo Stream on-"This file does not have a program associated with it for performing this action. Please install a program or, if one is already installed, create an association in the Default Programs control panel" Help!!!

    You are posting in the "icloud on my mac" forum, but your profile mentions Windows.  If using a mac, you need to have iphoto or aperture installed in order to receive new photos via photo stream.  If using windows, try posting in the iCloud on a PC forum.  You'll get better help there.
    https://discussions.apple.com/community/icloud/icloud_on_my_pc

  • Hi, please help with the installation of Lightroom 4, I bought a new Mac (Apple) and I want to install a software that I have on the album cd. My new computer does not have the drives. Can I download software from Adobe? Is my license number just to be ab

    Hi, please help with the installation of Lightroom 4, I bought a new Mac (Apple) and I want to install a software that I have on the album cd. My new computer does not have the drives. Can I download software from Adobe? Is my license number just to be able to download the srtony adobe.

    Adobe - Lightroom : For Macintosh
    Hal

  • HT204400 My wireless key password is three words connected by a - but the keyboard  on the Apple TV menu does not have this symbol! Help please

    Can anyone help- I am trying to connect the wireless network to the Apple TV and the keyboard letter/icons does not have the option of the - symbol. It's not under score in my wireless password it's three words connected with a -   I am either thick or well probably! Help

    Welcome to the Apple Community.
    Change the character screen by using the ' #+= ' button on the top row of characters, you'll find the ' - ' charcter at the end of the 5th row.

  • Getting Error "Apple ID does not have permission to access iTunes Connect" while logging to iTunes. Please help me in this regard

    Getting Error "Apple ID does not have permission to access iTunes Connect" while logging to iTunes. Please help me in this regard
    Regards,
    Amar

    See the "More Like This" section over there ===============>
    In the future, search before posting.

  • After Effects error : layer does not have a source.

    Hi All,
              I add a Text layer and then add my custom fill  effect to it. Then I call AdvItemSuite1()->PF_ForceRerender(in_data, &(params[0]->u.ld)) from AEGP for all the layers. But only for Text layer, AE pops up a dialog displaying the following error :
    After Effects error : layer does not have a source.
    (26::335)
    Why is this happening? What other call can I use to rerender all the layers?
    Thanks & Regards,
    Dheeraj

    Am 13.04.2011 12:21, schrieb dheeraj_c:
    For now just added a dummy parameter in the effect and calling AEGP_SetStreamValue() to render all the layer with effect.
    I also have experienced problems with PF_ForceRerender(),
    AEGP_SetStreamValu() seems like an alternative solution...

  • I want to import bookmarks from Safari on the Mac same computer. Firefox help says Menu Bar/File/Import. My Firefox does not have File/Import option. How do I import bookmarks from Safari to Firefox?

    I want to import bookmarks from Safari on the same Mac computer. Firefox
    Help says use Menu Bar/File/Import.
    My Firefox does not have File/Import option.
    How do I import bookmarks from Safari to Firefox?

    Import and Backup is the third (last) button on the toolbar in the Bookmarks Manager (Library) that looks like a star.<br />
    Other platforms show the text label, but on Mac you only see toolbar icons.

Maybe you are looking for

  • How to set the default file name for upload

    Hi All, I have the following BSP app for a file upload of a csv file. I want the page when displayed show the default file name to be loaded as c:\db1\currentPM.csv What changes do I need to make to get the default file name in the BSP app. Thanks Ka

  • Keep getting security error when trying to update itunes to 11.2.2

    need some help here..............even the manuel download only does not work

  • Third Generation iMacG5 logicboard problem

    Hi all, My iMac G5 (third generation) just died. Had just updated iTunes and QuickTime, was asked for a restart, and thereafter the screen stayed black and the fan revved high non-stop until I turned it off. Tried zapping the PRAM etc. to no avail (c

  • I can´t play the songs i got on my iPod (60gig) in any itunes program?

    Hey I whould like some help with my iPod. It is as the topic says, i can´t play the songs i got on my iPod at my computer(from the iPod). The songs are just grey and i cant press them or anything. There is also a small black lock icon at the bottom o

  • How do I place two graphics side by side.

    We are using a one column with a side head. (Not that that should matter I guess.) How would I place two graphics side by side, still numbering the figures correctly. We have tried several things and finallly got them even, but it is a big hassel and