SQL*Plus Worksheet DEFINE command

**I hope this is the correct place to put this, I don't see a forum for SQL*Plus Worksheet.**
I am having some trouble with SQL*Plus Worksheet. The following call to a package works fine,
EXECUTE package_name.procedure_name ('string_name');where it is required that my argument passed to the procedure needs the quotes as part of the string. However, when I try to use a variable instead of hardcoding the 'string_name' value, ie
DEFINE string_name = 'string_name';
EXECUTE package_name.procedure_name (&string_name);I get an error message saying that my variable needs to be defined (the call was made passing the string w/o the quotes). How can I pass the entire string, quotes and all, to the package call? I've tried concatenating them to the variable in the DEFINE and EXECUTE commands but I can't seem to come up with the correct syntax.
Does anybody know how to do this?

Here is the current SQL*Plus Worksheet command, and output (works):
EXECUTE amanda.role_executor.drop_role ('read_only');
PL/SQL procedure successfully completed.So, now I try to pass the argument as a variable, instead of hardcoding the value to the call:
DEFINE role_name = 'read_only';
EXECUTE amanda.role_executor.drop_role (&read_only);
BEGIN amanda.role_executor.drop_role (read_only); END;
ERROR at line 1:
ORA-06550: line 1, column 39:
PLS-00201: identifier 'READ_ONLY' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignoredAs you can see when I try to pass the string as a variable the single quotes get lost. How can I concatenate the single quotes to the string? I've tried everything I can think of but apparently Worksheet doesn't like the || symbols.

Similar Messages

  • Using variables in SQL Plus Worksheet

    I'm new to Oracle. I've developed in MS SQL for some time. I'm trying to debug a query we're using in an application. I paste it into SQL Plus Worksheet and get the message:
    SP2-0552: Bind variable "COUNTYPK" not declared.
    I could paste in a value, but I would like to define a variable before the query so that it will work the same way as it would in production.
    SELECT rsiplate.OWNER.work_area_code || '-' || SUBSTR(rsiplate.OWNER.work_phone_number, 1, 3) || '-' || SUBSTR(rsiplate.OWNER.work_phone_number, 4, 4) AS BUSINESSPHONE, trim(rsiplate.OWNER.first_name||' '||rsiplate.OWNER.middle_name||' '||rsiplate.OWNER.last_name) AS BUSINESSNAME, rsiplate.ADDRESS.address_line1 AS ADDRESSLINE1, rsiplate.ADDRESS.address_line2 AS ADDRESSLINE2, rsiplate.ADDRESS.city_name AS CITY, rsiplate.ADDRESS.state_code AS STATE, SUBSTR(rsiplate.ADDRESS.zip_code, 1, 5) AS POSTALCODE FROM rsiplate.WATERCRAFT_MASTER, rsiplate.WATERCRAFT_CURRENT, rsiplate.WATERCRAFT_REGIST_CURRENT, rsiplate.OWNER, rsiplate.WATERCRAFT_OWNER_CURRENT, rsiplate.ADDRESS WHERE rsiplate.WATERCRAFT_MASTER.WATERCRAFT_ID = rsiplate.WATERCRAFT_CURRENT.WATERCRAFT_ID AND rsiplate.WATERCRAFT_MASTER.LF_WATERCRAFT_REGIST_ORDER = rsiplate.WATERCRAFT_REGIST_CURRENT.WATERCRAFT_REGIST_ORDER AND rsiplate.WATERCRAFT_MASTER.LF_WATERCRAFT_ORDER = rsiplate.WATERCRAFT_CURRENT.WATERCRAFT_ORDER AND rsiplate.WATERCRAFT_MASTER.watercraft_id = rsiplate.WATERCRAFT_REGIST_CURRENT.watercraft_id and rsiplate.WATERCRAFT_MASTER.watercraft_id = rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_id and rsiplate.WATERCRAFT_OWNER_CURRENT.owner_id = rsiplate.OWNER.owner_id and rsiplate.WATERCRAFT_MASTER.watercraft_owner_group = rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_owner_group and rsiplate.ADDRESS.address_set_id = rsiplate.OWNER.address_set_id and rsiplate.WATERCRAFT_MASTER.data_status_code = 1 and rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_owner_order = 1 and rsiplate.WATERCRAFT_REGIST_CURRENT.REGIST_EXPIRATION_DATE >= SYSDATE AND rsiplate.WATERCRAFT_CURRENT.WATERCRAFT_USE_CODE = 3 AND rsiplate.ADDRESS.COUNTY_NUMBER = :CountyPK GROUP BY rsiplate.OWNER.work_area_code, rsiplate.OWNER.work_phone_number, rsiplate.OWNER.first_name, rsiplate.OWNER.middle_name, rsiplate.OWNER.last_name, rsiplate.ADDRESS.address_line1, rsiplate.ADDRESS.address_line2, rsiplate.ADDRESS.city_name, rsiplate.ADDRESS.state_code, rsiplate.ADDRESS.zip_code;

    Okay, I made some adjustements:
    SET DEFINE :
    DEFINE :COUNTYPK = '01'
    SELECT rsiplate.OWNER.work_area_code||'-'||SUBSTR(rsiplate.OWNER.work_phone_number, 1, 3)||'-'||SUBSTR(rsiplate.OWNER.work_phone_number, 4, 4) AS BUSINESSPHONE, trim(rsiplate.OWNER.first_name||' '||rsiplate.OWNER.middle_name||' '||rsiplate.OWNER.last_name) AS BUSINESSNAME, rsiplate.ADDRESS.address_line1 AS ADDRESSLINE1, rsiplate.ADDRESS.address_line2 AS ADDRESSLINE2, rsiplate.ADDRESS.city_name AS CITY, rsiplate.ADDRESS.state_code AS STATE, SUBSTR(rsiplate.ADDRESS.zip_code, 1, 5) AS POSTALCODE FROM rsiplate.WATERCRAFT_MASTER, rsiplate.WATERCRAFT_CURRENT, rsiplate.WATERCRAFT_REGIST_CURRENT, rsiplate.OWNER, rsiplate.WATERCRAFT_OWNER_CURRENT, rsiplate.ADDRESS WHERE rsiplate.WATERCRAFT_MASTER.WATERCRAFT_ID = rsiplate.WATERCRAFT_CURRENT.WATERCRAFT_ID AND rsiplate.WATERCRAFT_MASTER.LF_WATERCRAFT_REGIST_ORDER = rsiplate.WATERCRAFT_REGIST_CURRENT.WATERCRAFT_REGIST_ORDER AND rsiplate.WATERCRAFT_MASTER.LF_WATERCRAFT_ORDER = rsiplate.WATERCRAFT_CURRENT.WATERCRAFT_ORDER AND rsiplate.WATERCRAFT_MASTER.watercraft_id = rsiplate.WATERCRAFT_REGIST_CURRENT.watercraft_id and rsiplate.WATERCRAFT_MASTER.watercraft_id = rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_id and rsiplate.WATERCRAFT_OWNER_CURRENT.owner_id = rsiplate.OWNER.owner_id and rsiplate.WATERCRAFT_MASTER.watercraft_owner_group = rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_owner_group and rsiplate.ADDRESS.address_set_id = rsiplate.OWNER.address_set_id and rsiplate.WATERCRAFT_MASTER.data_status_code = 1 and rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_owner_order = 1 and rsiplate.WATERCRAFT_REGIST_CURRENT.REGIST_EXPIRATION_DATE >= SYSDATE AND rsiplate.WATERCRAFT_CURRENT.WATERCRAFT_USE_CODE = 3 AND rsiplate.ADDRESS.COUNTY_NUMBER = :CountyPK GROUP BY rsiplate.OWNER.work_area_code, rsiplate.OWNER.work_phone_number, rsiplate.OWNER.first_name, rsiplate.OWNER.middle_name, rsiplate.OWNER.last_name, rsiplate.ADDRESS.address_line1, rsiplate.ADDRESS.address_line2, rsiplate.ADDRESS.city_name, rsiplate.ADDRESS.state_code, rsiplate.ADDRESS.zip_code;
    But I still get this:
    SP2-0317: expected symbol name is missing
    old 2: iplate.WATERCRAFT_REGIST_CURRENT.watercraft_id and rsiplate.WATERCRAFT_MASTER.watercraft_id = rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_id and rsiplate.WATERCRAFT_OWNER_CURRENT.owner_id = rsiplate.OWNER.owner_id and rsiplate.WATERCRAFT_MASTER.watercraft_owner_group = rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_owner_group and rsiplate.ADDRESS.address_set_id = rsiplate.OWNER.address_set_id and rsiplate.WATERCRAFT_MASTER.data_status_code = 1 and rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_owner_order = 1 and rsiplate.WATERCRAFT_REGIST_CURRENT.REGIST_EXPIRATION_DATE >= SYSDATE AND rsiplate.WATERCRAFT_CURRENT.WATERCRAFT_USE_CODE = 3 AND rsiplate.ADDRESS.COUNTY_NUMBER = :CountyPK GROUP BY rsiplate.OWNER.work_area_code, rsiplate.OWNER.work_phone_number, rsiplate.OWNER.first_name, rsiplate.OWNER.middle_name, rsiplate.OWNER.last_name, rsiplate.ADDRESS.address_line1, rsiplate.ADDRESS.address_line2, rsiplate.ADDRESS.city_name, rsiplate.ADDRESS.state_code, rsiplate.ADDRESS.zip_code
    new 2: iplate.WATERCRAFT_REGIST_CURRENT.watercraft_id and rsiplate.WATERCRAFT_MASTER.watercraft_id = rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_id and rsiplate.WATERCRAFT_OWNER_CURRENT.owner_id = rsiplate.OWNER.owner_id and rsiplate.WATERCRAFT_MASTER.watercraft_owner_group = rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_owner_group and rsiplate.ADDRESS.address_set_id = rsiplate.OWNER.address_set_id and rsiplate.WATERCRAFT_MASTER.data_status_code = 1 and rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_owner_order = 1 and rsiplate.WATERCRAFT_REGIST_CURRENT.REGIST_EXPIRATION_DATE >= SYSDATE AND rsiplate.WATERCRAFT_CURRENT.WATERCRAFT_USE_CODE = 3 AND rsiplate.ADDRESS.COUNTY_NUMBER = 01 GROUP BY rsiplate.OWNER.work_area_code, rsiplate.OWNER.work_phone_number, rsiplate.OWNER.first_name, rsiplate.OWNER.middle_name, rsiplate.OWNER.last_name, rsiplate.ADDRESS.address_line1, rsiplate.ADDRESS.address_line2, rsiplate.ADDRESS.city_name, rsiplate.ADDRESS.state_code, rsiplate.ADDRESS.zip_code
    iplate.WATERCRAFT_REGIST_CURRENT.watercraft_id and rsiplate.WATERCRAFT_MASTER.watercraft_id = rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_id and rsiplate.WATERCRAFT_OWNER_CURRENT.owner_id = rsiplate.OWNER.owner_id and rsiplate.WATERCRAFT_MASTER.watercraft_owner_group = rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_owner_group and rsiplate.ADDRESS.address_set_id = rsiplate.OWNER.address_set_id and rsiplate.WATERCRAFT_MASTER.data_status_code = 1 and rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_owner_order = 1 and rsiplate.WATERCRAFT_REGIST_CURRENT.REGIST_EXPIRATION_DATE >= SYSDATE AND rsiplate.WATERCRAFT_CURRENT.WATERCRAFT_USE_CODE = 3 AND rsiplate.ADDRESS.COUNTY_NUMBER = 01 GROUP BY rsiplate.OWNER.work_area_code, rsiplate.OWNER.work_phone_number, rsiplate.OWNER.first_name, rsiplate.OWNER.middle_name, rsiplate.OWNER.last_name, rsiplate.ADDRESS.address_line1, rsiplate.ADDRESS.address_line2, rsiplate.ADDRESS.city_name, rsiplate.ADDRESS.state_code, rsiplate.ADDRESS.zip_code
    ERROR at line 2:
    ORA-00933: SQL command not properly ended

  • SQL*Plus Worksheet formating

    I have Oracle Client 8.1.7 installed in my computer, and I can't
    seem to have the desired output format with the SQL*Plus
    worksheet.
    I have a database where the tables have several column, and most
    of these columns are text with 1024 characters length. I set the
    linesize to a huge number (say 3000), the trim and trimspool on,
    and I get the results ok.
    But, when I want to do a select from a table which is much
    smaller, the worksheet is always writing the complete linesize...
    Is there a way to display the columns according to the size they
    actually have (e.g. defined by the longest element) that is
    always valid. I mean without having to set column options for
    each table.
    Thank you in advance.
    Ana

    The column width sizing rules are a little opaque. The column size is a function of things like the width that the DB thinks the column is (could be huge if a SQL function is being selected), the column name or heading width, the linesize (for very wide columns), any global format (e.g. SET NUMWIDTH), or the explicit COLUMN FORMAT.
    For consistency and portability I'd always recommend using an explicit COLUMN FORMAT. You can never tell if someone is going to run your report after previously setting a COLUMN FORMAT of the same name. Or a new database version may come out where the default datatype of a SQL function has changed. In the past this has happened when CHARs became the longer VARCHAR2s.
    I don't think Enterprise Manager's SQL Worksheet (a simplistic interface that just calls SQL*Plus in the background) is doing anything special for formatting. So COLUMN FORMAT will work fine.
    -- CJ

  • Giving parameter to spreport.sql in Sql plus worksheet

    can any one please tell me how can we give value for the begining snap and ending snap to spreport in sql plus worksheet
    best regards
    asif

    define begin_snap=10
    define end_snap=66
    @ C:\oracle\ora92\rdbms\admin\spreport.sql
    Best Regards
    Krystian Zieja / mob

  • Cancel runnning SQL in SQL*Plus Worksheet?

    Hi,
    can I Cancel a runnning SQL in SQL*Plus Worksheet?
    Thanks
    Markus

    Probably not in current versions.
    SQL*Plus Worksheet is just a Java wrapper around
    command-line SQL*Plus. I recall the EM team were keen
    to see a cancelling feature in 10g, which is one of the
    reasons EM 10g will call iSQL*Plus.
    The iSQL*Plus web interface has had cancel for a few versions
    already. It has a button specially for that.
    (For reference, the EM forum is at Enterprise Manager
    -- CJ

  • Cleaning screen at SQL*PLUS Worksheet

    Is there any simple command, macro or magical trick to clean the lower screen? (the one were you can not write and displays the data from your selects, prompts, ORA-errors, etc...)
    thanks

    Ok, I thought that clear button would clear only the upper screen, but if I click and focus with the mouse at the lower screen it will clean the lower screen.
    Thanks
    PD: Yes I was talking about SQL*PLUS Worksheet, not SQLPLUS

  • SQL*Plus Worksheet Question

    I just upgraded to 8.1.6 and started using SQLPlus worksheet. Is there away to set output screen to display horizontal instead of vertical?
    Thank you in Advance
    null

    In some client version (8.1.5 or 8.1.6), I remember I had the same problem. I think that the solution is to use or not the semi-column at th end of the command.
    But, remember that Java SQL*Plus Worksheet is using SQL*Plus. Then if U have a lot of results to display, it's longer with the worksheet version.

  • Is the SQL * Plus Worksheet included in the Oracle 10g Express Edition?

    Hello All,
    I need to install Oracle 10g for a SQL class that I will be taking this year. I will be installing it in my laptop (Pentium 4, 1GB RAM). I was told by the Professor that I needed to have the SQL*Plus Worksheet. I would like to know which version of Oracle do I need to install, and If it includes the SQL*Plus Worksheet.
    This is my first time working & installing Oracle, so I would appreciate if anyone could guide me thru this process.
    Thanks a lot,
    Ed

    No, it is not included.
    However, the same functionality, and more, is in Oracle SQL Developer - also available free and download-able from the same area as Oracle Express Edition.
    Ask your prof why he want Worksheet. If it's only for the ability to scroll and correct previous SQL (eg: easier time correcting mistakes), and loading scripts, ask if SQL Developer would be allowed. It's much superior and allows you to use XE, which will not sink your laptop like the EE version will.

  • SQL*PLUS Worksheet Width

    I'm (bery) new to Oracle. I'm trying to figure out how to make the output results of a select statement in SQL*Plus Worksheet not wrap. Is there a way to do this?
    Thank you
    JohnD

    hi friends,
    I have used SET LINESIZE 1000 to increase width and display all column details in a row.
    But now it is not scrolling till the last column details displayed on screen.Suppose there are 12 columns in my table and i could see only 8 which are displayed on my screen.
    How can i scroll to right till the last column?
    Thank you,
    Regards,
    Raghv

  • SQL*Plus Worksheet in Personal Oracle 8.1.6

    Why does a select query in SQL*Plus Worksheet not return any results, but the same query in SQLPLUS or TOAD does?
    I am using the version that comes with Personal Oracle8i for NT (Oracle 8.1.6). Version of Enterprise Manager is 2.1.0.1.0.
    Database is Oracle8i Enterprise 8.1.5.

    What is the query you have given?
    Is it happening for all the queries or only for this one.
    Please reply.
    Regards
    Ravi

  • Dowload SQL*Plus worksheet

    Hello, I download this link: http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html and I installed him, but I do not find SQL Plus worksheet, why?
    Any link to download SQL * Plus worksheet?
    Thanks.

    918545 wrote:
    Hello, I download this link: http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html and I installed him, but I do not find SQL Plus worksheet, why?
    Any link to download SQL * Plus worksheet?
    Thanks.what is "SQL * Plus worksheet"?

  • Connection Via SQL*Plus Worksheet

    Dear Friends,
    I have a peculiar problem. I am connecting via 9i client to a oracle 8i server.
    I could manage to access the database via 9i client's EM and SQL scratch pad. But I am unable to connect via SQL*plus worksheet.
    I got this error
    ERROR:
    ORA-12154: TNS:could not resolve service name
    While I test the service name via Oracle Net manager, it is successful.
    Anybody could shed some light.
    Regards
    Kumar

    Enterprise Manager still has SQL*Plus Worksheet. See:
    http://download-west.oracle.com/docs/cd/B10501_01/em.920/a96670/ch_alone.htm#1015179
    -- CJ

  • SQL*Plus Worksheet SuSE 8.2

    I'am unable to login over SQL*Plus worksheet (Oracle 9.0.1) under SuSE 8.2. I get error messages "SQL*Plus worksheet exited" or "write error". oemapp dbastudio is working properly.

    I have the exact same problem. Have you had any luck yet? Did you apply any kernel parameter changes/tuning yet? How much physical memory do you have on you oralce box? I have 128M. Please let me know if you solve this one.
    Thanks,
    Doug
    [email protected]

  • SQL*Plus,Worksheet & Server Manager Can't Recognize Commands

    Whenever I (or a script)use SQL*Plus commands (such as PROMPT, ACCEPT, or HELP) I get "ORA-00900: invalid SQL statement".
    What is wrong with my installation? Or what might I be doing wrong? Everything else works fine (such as connectivity & normal SQL).
    I'm running Server 7.3.4 on NT.
    Thanks.

    hi,
    thanks it works.
    But i have also downgraded java from 1.6.0_07 to 1.5.0_16. With java 1.6.0_07 i get the
    failure every minutes. It's not possible to change exit an restart sql developer every 2
    minutes.
    Karlheinz

  • How to see the content of stored prodecure in sql plus worksheet or sql.plu

    Hi
    i want to see the content of the stored procedure on sql worksheet or sql plus. is there any command for this ?
    please let me know
    thanks

    Hi Anil:
    Following is for SQL*Plus
    If you are logged on to the schema that owns the stored procedure you can issue the following query:
    select text from user_source where name = 'MY_PROG_NAME'
    ORDER BY TYPE, LINE ASC;
    Where MY_PROG_NAME could be the name of a package, procedure or function. Note that when you look at a package source you'll get the specfification and the body listing, in that case you may want to split them into two with following queries:
    spool MY_PROG_NAME.spec
    select text from user_source
    where name = 'MY_PROG_NAME'
    AND TYPE = 'PACKAGE'
    ORDER BY TYPE, LINE ASC;
    SPOOL OFF
    spool MY_PROG_NAME.body
    select text from user_source
    where name = 'MY_PROG_NAME'
    AND TYPE = 'PACKAGE BODY'
    ORDER BY TYPE, LINE ASC;
    SPOOL OFF
    If you are logged on as SYSTEm, you can substitute USER with DBA and look at code for all schemas, however you may need to add OWNER to your query.
    DESC USER_SOURCE
    Name Null? Type
    NAME NOT NULL VARCHAR2(30)
    TYPE VARCHAR2(12)
    LINE NOT NULL NUMBER
    TEXT VARCHAR2(2000)
    DESC DBA_SOURCE
    Name Null? Type
    OWNER NOT NULL VARCHAR2(30)
    NAME NOT NULL VARCHAR2(30)
    TYPE VARCHAR2(12)
    LINE NOT NULL NUMBER
    TEXT VARCHAR2(2000)
    Hope this helps,
    Thomas

Maybe you are looking for

  • BPEL 10.1.2 hub-and-spoke or distributed architecture?

    Hi, I'm currently wrestling with the following question:BPEL 10.1.2 hub-and-spoke or distributed architecture? Hi, I'm currently wrestling with the following question: An ESB as per definition of e.g. Forrester should be capable of supporting a distr

  • Recording Speed To Fast

    I use Total Record To record Music that I Hear on my computer but when i play it back the speed is higher then it should be and therefor sounds like chipmunk almost

  • MacBook Pro Finder

    Why, each time I start up the MacBook Pro, do I get a bouncy "finder" icon on the bottom menu bar and a message : The last time you opened Finder, it unexpectedly quit while reopening windows. Do you want to try to reopen its windows again? I don't e

  • Change TMS SQL usage Port

    Hi, We use TMS version 14.6 I need change default ports used by SQL server (destination ports TCP 1433 ->TCP 3341) Please find sheet or give advise Thank you

  • Trouble getting Flex 4.1A to run using Internet Explorer 11

    We have an application that is a Javascript application with an embedded Flex application compiled using 4.1A. It currently runs fine on all browsers except Internet Explorer 11. We sometimes get a security sandbox violation: ExternalInterface caller