Accepting user input and then running grant statements

Hi I have a script which creates a database, at the end of this script I need to change user, and then run a number of grants. I need to accept the name of the schema to make the grants to from the user. The code I have been trying to use is below
--Prompt for portal password and connect as portal
connect portal
--Issue grants for portal apis
PROMPT 'Enter the schema name'
ACCEPT schema
@provsyns.sql &schema
PROMPT 'Enter the schema name'
ACCEPT schema
grant select on WWSEC_PERSON to &&schema;
PAUSE
grant select on WWSEC_GROUP$ to &&schema;
PAUSE
grant execute on wwctx_api_private to &&schema;
grant execute on pkg_oid to &&schema;
grant execute on pkg_error_handling to &&schema;
UNDEFINE schema
When I run the code I get and ORA-00987: missing or invalid username(s)
Can anyone help me please?
Many thanks,
Danny

Hi,
You can write a genric procedure to achive the desired output. Pass 'Y' or 'N' in the procedure.
Call that procedure in simple pl/sql block during runtime using substituton operator.
For ex
create or replace procedure p1(category_in in varchar2)
IS
BEGIN
if (category_in='Y')
then
prcdr1()
/** Write your logic here ***/
elsif(category_in='N') then
prcdr2()
/** write your logic here***/
end if;
exception
/***write the exception logic ***/
end p1;
Begin
p1('&cat');
end;Regards,
Achyut K
Edited by: Achyut K on Aug 6, 2010 5:20 AM

Similar Messages

  • Accepting user input and executing a PL/SQL block using it

    Hi All,
    I am working on a requirement wherein I have to accept values from the user for the various arguments to be supplied to a PL/SQL block and then execute it using these values. For now, I am using the following logic:
    PROMPT Enter value for the Category
    ACCEPT cCategory CHAR PROMPT 'Category:'
    DECLARE
    cCategry CHAR(1) := '&cCategory';
    BEGIN
    DBMS_OUTPUT.PUT_LINE('The value of the Category as entered by you is' || cCategory);
    END;
    PROMPT Press y if you want to proceed with the current values, or press n if you want to re-enter the values
    ACCEPT cChoice CHAR Prompt 'Enter y or n:'
    DECLARE
    cCategry CHAR(1) := '&cCategory';
    sErrorCd VARCHAR2(256);
    sErrorDsc VARCHAR2(256);
    BEGIN
    IF '&cChoice' = 'y'
    THEN
    DBMS_OUTPUT.PUT_LINE('Starting with the process to execute the stored proc');
    --- schema1.package1.sp1(cCategry, sErrorCd, sErrorDsc);
    --- DBMS_OUTPUT.PUT_LINE('Error Code :' || sErrorCd);
    --- DBMS_OUTPUT.PUT_LINE(' Error Description :' || sErrorDsc);
    ELSIF '&cChoice' = 'n'
    THEN
    Now I want that the proc again start executing in the loop from the 1st line i.e. PROMPT Enter value for the Category. However i see that this is not possible to do that PROMPT statements and accepting user inputs execute only on the SQL prompt and not inside a PL/SQL block.
    Is there an alternate method to establish this?
    Thanks in advance.

    Hi,
    You can write a genric procedure to achive the desired output. Pass 'Y' or 'N' in the procedure.
    Call that procedure in simple pl/sql block during runtime using substituton operator.
    For ex
    create or replace procedure p1(category_in in varchar2)
    IS
    BEGIN
    if (category_in='Y')
    then
    prcdr1()
    /** Write your logic here ***/
    elsif(category_in='N') then
    prcdr2()
    /** write your logic here***/
    end if;
    exception
    /***write the exception logic ***/
    end p1;
    Begin
    p1('&cat');
    end;Regards,
    Achyut K
    Edited by: Achyut K on Aug 6, 2010 5:20 AM

  • URGENT!.....accepting user input and string conversion

    I have a problem with a text-based menu I am trying to create for a Shape class with rectangle, circle, etc... subclasses below it...here is a code clip
    //The menu choices given to the user.
              System.out.println("Please select which shape you would like to create:\n");
              System.out.println("(1)Rectangle");
              System.out.println("(2)Square");
              System.out.println("(3)Circle");
              System.out.println("(4)Ellipse");
              System.out.println("(5)Exit the program\n");
              System.out.print("Enter your choice (1,2,3,4 or 5): ");
         menuChoice=(char)System.in.read();
    switch(menuChoice) {
    case '1':                              
    System.out.println("\nTo create a rectangle, please enter the following dimensions below (integers only)...\n");                    
         System.out.print("Center X co-ordinate = ");
              while((x=(char)System.in.read()) !='\n')
              CentXBuf.append(x);     
         System.out.print("Center Y co-ordinate = ");
              while((y=(char)System.in.read()) !='\n')
              CentYBuf.append(y);
    The above works fine, however, when the the user inputs the menu choice, it does not let me input the center x co-ordinate and goes on to the second input of the center y co-ordinate then the program crashes with a NumberFormatException
    I tried to replace
         menuChoice=(char)System.in.read();
    with
         while((z=(char)System.in.read()) !='\n'){
              zBuff.append(z);
         String v = new String(zBuff);
         int menuChoice = Integer.valueOf(v).intValue();
    but the above itself gives me a NumberFormatException also!
    What do I do?!?!

    Try this:
    BufferedReader reader = new BufferedReader(
    new InputStreamReader(System.in)
    String input = reader.readLine();

  • SQL LOGIC - How to accept USER input and use that data in SQL Logic?

    Hello Experts
    Can anyone of you please explain in detail how to acheive the above task am a begginner, it would be great help for me.
    Thanks in Advance.

    Hi,
    You mean to say, you need to use inputs from Data manager Prompts in your Script Logic.
    From Help File
    You can use the EvDTSModifyPkg task to dynamically pass a text string to logic in Data Manager.  For example, a user who wishes to dynamically pass a text string representing a year (which is a portion of the *XDIM_MEMBERSET instruction) could use the following steps:
    Using the EvDTSModifyPkg task, prompt for the year, i.e., PROMPT(TEXT,%TEXT%,"select a year")
    Pass the returned %TEXT% to the FormulaScript of the RunLogic task as follows: TASK(RUNLOGIC,FORMULASCRIPT,"*FUNCTION MYYEAR=%TEXT%u201D)
    In the Data Manager logic, use the dynamically created function as follows: *XDIM_MEMBERSET TIME=MYYEAR.INPUT.
    The logic name in the RunLogic task must be specified with the .LGF extension to enforce its validation at run time.
    BPC NW 2.0 Version Works differently.
    Hope this Helps,
    Kranthi

  • Failed to accept user input when run report on Web

    I've testing a report with one input parameter. It's a date with default current date. It is done by using SQL 'select sysdate from dual;' has been added to before form trigger. User is allowed to input any date other than the default sysdate before submitting the report. The report works fine when run in report builder, but it's failed to accepted user input date when called through web browser. The report still uses the current date as SQL parameter rather than user input date.
    Can anyone help me to fix this bug?
    The report is develped by Oracle 9i and is saved and run in .rdf format.

    I created a report with a user defined parameter p_date of DATE type. In the layout model, I created a field with p_date as data source. In the before form trigger, I put
    'select sysdate into :p_date from dual;
    I run the report through rwservlet:
    http://host:port/reports/rwservlet?report=datetest.rdf&destype=cache&desformat=html&userid=scott/tiger@orcl&paramform=yes
    In the html parameter form, I change the date from default current date to a future date and that date is shown in the final report.
    So I can't reproduce the bug.
    One thing you can try it to turn on reports server trace file, see what command line is sent to reports server when you submitting the parameter form.
    Thanks,
    -Shaun

  • How to accept user inputs from  sql script

    I want to create Tablespace useing sql script , but the location of the data file I need accept from user . (to get the location of the data file ) .
    How can I accept user input from pl/sql .
    Example :
      CREATE TABLESPACE  TSPACE_INDIA LOGGING
         DATAFILE 'H:\ORACLE_DATA\FRSDB\TSPACE_INDI_D1_01.dbf'
         SIZE 500M  AUTOEXTEND ON NEXT  1280K MAXSIZE UNLIMITED
         EXTENT MANAGEMENT LOCAL;here I need to accept location of the datafile from user ie : 'H:\ORACLE_DATA\FRSDB\TSPACE_INDI_D1_01.dbf'

    Hi,
    Whenenever you write dynamic SQL, put the SQL text into a variable. During development, display the variable instead of executing it. If it looks okay, then you can try executing it in addition to displaying it. When you're finished testing, then you can comment out or delete the display.
    For example:
    SET     SERVEROUTPUT     ON
    DECLARE
        flocation     VARCHAR2 (300);
        sql_txt     VARCHAR2 (1000);
    BEGIN
        SELECT  '&Enter_The_Path'
        INTO    flocation
        FROM    dual;
        sql_txt :=  'CREATE TABLESPACE SRC_TSPACE_INDIA LOGGING
         DATAFILE' || flocation || ' "\SRC_TSPACE_INDI_D1_01.dbf" ' || '
         SIZE 500M  AUTOEXTEND ON NEXT  1280K MAXSIZE UNLIMITED
         EXTENT MANAGEMENT LOCAL ';
        dbms_output.put_line (sql_txt || ' = sql_txt');
    --  EXECUTE IMMEDIATE sql_txt;
    END;
    /When you run it, you'll see something like this:
    Enter value for enter_the_path: c:\d\fubar
    old   5:     SELECT  '&Enter_The_Path'
    new   5:     SELECT  'c:\d\fubar'
    CREATE TABLESPACE SRC_TSPACE_INDIA LOGGING
         DATAFILEc:\d\fubar
    "\SRC_TSPACE_INDI_D1_01.dbf"
         SIZE 500M  AUTOEXTEND ON NEXT  1280K MAXSIZE
    UNLIMITED
         EXTENT MANAGEMENT LOCAL  = sql_txt
    PL/SQL procedure successfully completed.This makes it easy to see that you're missing a space after the keyword DATAFILE. There are other errrors, too. For example, the path name has to be inside the quotes with the file name, without a line-feed between them, and the quotes should be single-quotes, not double-quotes.
    Is there some reason why you're using PL/SQL? In SQL, you can just say:
    CREATE TABLESPACE SRC_TSPACE_INDIA LOGGING
    DATAFILE  '&Enter_The_Path\SRC_TSPACE_INDI_D1_01.dbf'
    SIZE 500M  AUTOEXTEND ON NEXT  1280K MAXSIZE UNLIMITED
    EXTENT MANAGEMENT LOCAL;though I would use an ACCEPT command to given a better prompt.
    Given that you want to use PL/SQL, you could assign the value above to sql_txt. If you need a separate PL/SQL variable for flocation, then you can assign it without using dual, for example:
    DECLARE
        flocation     VARCHAR2 (300)     := '&Enter_The_Path';The dual table isn't needed very much in PL/SQL.
    Edited by: Frank Kulash on Jan 10, 2013 6:56 AM

  • After "Hello World" - my first adventure in accepting user input

    Hey
    I'm trying to teach myself java and I'm attempting to move on from printing hello world to the screen :)
    I've written the following:
    import java.io.*;
    public class firstapp {
         int value1,
              value2,
              result;
         public static int add(int value1, int value2){
             return value1 + value2;
         public static void main(String args[]){
              int value1,
                        value2,
                        result;
              BufferedReader reader;
              reader = new BufferedReader(new InputStreamReader(System.in));
              //try block
              try{
                   System.out.println("Please type the first number");
                   value1 = reader.read();
                   System.out.println("Please type the second number");
                   value2 = reader.read();
                   result = add(value1,value2);
                   System.out.println("Added together they equal " + result);
         catch (IOException ioe){
              System.out.println("Something bad happened");{
         }It doesnt do what I expected though. It prompts for the first number which i enter. It then prints "Please type the second number" but doesnt accept any input and goes on to print "Added together they equal 62" (this is when 1 is entered as the first number).
    Im so new to this so excuse it being the most basic of basic questions. But where is it getting 62 from?
    Thanks

    BufferedReader.read() isn't the best method for this. It reads a single character, which you store as an int. If you entered "5" for example, the ascii value of 5 is being stored, not the value 5. The second read() call is most likely reading the carriage return, so it adds 53 and 13, and prints that out, for example. If you have version 1.5 or better, use the Scanner class instead, it has a nextInt() method that does what you want.

  • Accept user input

    Dear All,
    How do we accept user input in isql*plus in 9i? I am writing pl/sql code that requires user input but i get the message:
    SP2-0850: Command "accept" is not available in iSQL*Plus
    the figure you requested is:
    PL/SQL procedure successfully completed.

    Also you can use some commands at sqlplus to add/delete/append lines of sql buffer.
    append (a)
    insert (i)
    del (d)
    run (r)iline (l) nth line (1l or 2l ...)
    change c/<old value>/<new value>
    etc.,
    << Sample >>
    SRI>select * from bonus;
    ENAME JOB SAL COMM
    Sri DBA 1000 123
    Sam Sales 1022 10
    Elapsed: 00:00:00.00
    SRI>c/*/ename,job
    1* select ename,job from bonus
    SRI>r
    1* select ename,job from bonus
    ENAME JOB
    Sri DBA
    Sam Sales
    Elapsed: 00:00:00.01
    SRI>i
    2 where ename = 'Sri';
    ENAME JOB
    Sri DBA
    Elapsed: 00:00:00.01
    SRI>;
    1 select ename,job from bonus
    2* where ename = 'Sri'
    SRI>2
    2* where ename = 'Sri'
    SRI>DEL
    SRI>;
    1* select ename,job from bonus
    -Sri

  • Wait for 3 minutes and then run another method

    I'm calling a JMS service lets say runProgress() the method adds a new row into a database then waits for 3 minutes and then runs another method that removes the row from the table.
    I was thinking about this, and thought that I could create a new Thread, let it wait for 3 minutes and the run the other method.
    The thing is what happens if there are 10.000 users running this at the same time, then there would be 10.000 Threads, wouldn't it be a hevy load on the server.
    Is there any other way?? Suggestions?

    What do you think about if there are massive, like
    10.000+, queue's in memory, this would be slow down
    for the server, right? or isn't it a trouble?you don't need 10.000 queues - just one single queue. you may have a lot of objects in the queue but this is at most a memory problem - depends on the size of the information you need.
    maybe i was not clear enough: you have a single queue where the tasks are put into. then there are other threads (at least 1) that read from the queue and perform actions.
    One option, that I don't know how to do yet but
    thinking about it, is to let the database have some
    kind of a procedure that would run after 3 minutes,
    but I guess that I were only moving the memory trouble
    from the app-server to the database. (hope you
    understand me)yes, i think so.
    So it would be just as good to do this in the
    app-server as in the database, what do you think?a good idea. typically with all these optimization issues you just have to try out. otherwise you won't know the result.
    robert

  • How to add a new user property and then retrieve it  from a portlet

    Trying to add a user property and then retrieve it form a remote web service?
    Add a user property and map it
    1. Create a property2. Go to Global Object Property Map3. Go to users, edit and select the new property.4. Go to User Profile Manager5. For portlets, go to the "Position Information" section and add it. (for the purpose of this test, add it to the profile section as well)6. Under the "User Profile Manager" go to the "User Information - Property Map" step in the wizard and 7. Go to the "User Information Attribute" and add the property.8. Click on the pencil to the right of it and give it a name (The name is what's going to appear in the list of user information under the portlet web service)9. Click finish10. Now create/edit the web service for the portlet from which you want to displays user properties. 11. Under the "User Information", click "add existing user Info" and select the property you want.12. From the portal toolbar, edit the user profile under "My Account" and then "Edit user Profile" and give the new property a value. 13. Test code below: ================================in C# IPortletContext context = PortletContextFactory.CreatePortletContext(Request,Response);IPortletRequest portletRequest = context.GetRequest();System.Collections.IDictionary UserInfoVariables = portletRequest.GetSettingCollection(SettingType.UserInfo);System.Collections.IDictionaryEnumerator UserInfo = UserInfoVariables.GetEnumerator();
    while(UserInfo.MoveNext()){   //to display in a listbox   ListBox1.ClearSelection();   ListBox1.Items.Add(UserInfo.Key.ToString() + ": " + UserInfo.Value);}===========================in ASP: <%Dim objSettings, dUserInfo, sEmpIDSet objSettings = Server.CreateObject("GSServices.Settings") ' get the user info settings, get employee ID from user infoSet dUserInfo = objSettings.GetUserInfoSettings
    for each item in dUserInfo response.Write "<BR>" & item & ": " & dUserInfo(item)next%>

    IPortletContext portletContext = PortletContextFactory.createPortletContext(req, res);
    IPortletRequest portletReq = portletContext.getRequest();
    String value = portletReq.getSettingValue(SettingType.Portlet,settingName);

  • Why Mac crashes when I run the clean speech ring of osx and then run the RestoreTime Machine?

    Why Mac crashes when I run the clean speech ring of osx and then run the RestoreTime Machine? Could it be that I run restore the setup from a usb drive. I've done thisbefore and when it has not been a problem.
    Does anyone have a good answer on this so I'm happy.

    kjell-einar wrote:
    Why Mac crashes when I run the clean speech ring of osx
    What is that?
    run the RestoreTime Machine?
    What are you restoring? 
    Do you mean a full system restore?  Or something else?
    When does your Mac crash -- during the restore, when you try to start up afterwards, or ?

  • How to compare user input and database data?

    hi, I am new to JAVA, i hope i didnt post wrong forum :P
    I would like to know how to get user data input from web page(client side) and compare with the data in database (server side)?
    What i doiong is using the JavaScript to get the user input and compare with the JSP. but this way it seem like not a good way! Because i facing a lot of problem to get the user input!!
    Thx a lot!!
    function pasteData(obj){
              var em_num_select = obj;
         //document.write(em_num_select);
              <%
                SQLSelectNO = "SELECT em_num FROM emmast ";
                   try {
                        getEmpNo = db.execSQL(SQLSelectNO);
                   }catch(SQLException e){
                        System.err.println("Query Error!!");
                   while(getEmpNo.next()){
                        matchEmpNo = getEmpNo.getString("em_num");
                        %>if (em_num_select == '<%=matchEmpNo%>'){
                        <%
                                  String SQLgetAllInfo = "SELECT em_num, em_name, em_init, "+
                                                                                         "em_buyer_flag, em_dsgn_cde, em_proj_all, "+
                                                                                         "em_proj_cde1, em_proj_cde2, em_proj_cde3 "+
                                                                                         "FROM emmast "+
                                                                                         "WHERE em_num = '"+matchEmpNo+"' ";
                                  try{
                                       getAllInfo = db.execSQL(SQLgetAllInfo);
                                  }catch(SQLException e){
                                       System.err.println("Query Error");
                                  while(getAllInfo.next()){%>
                                       document.all.emp_name.value = '<%=getAllInfo.getString("em_num")%>'
                                       document.all.emp_init.value = '<%=getAllInfo.getString("em_name")%>'
                                       document.all.emp_disg.value = '<%=getAllInfo.getString("em_dsgn_cde")%>'
                                       document.all.emp_buyer_flg.value = "<%=getAllInfo.getString("em_buyer_flag")%>";
                                       document.all.emp_basis.value = "<%=getAllInfo.getString("em_proj_all")%>";<%System.out.println(getAllInfo.getString("em_proj_cde1"));%>
                                       document.all.emp_pro_cde1.value = "<%=getAllInfo.getString("em_proj_cde1")%>";
                                       document.all.emp_pro_cde2.value = "<%=getAllInfo.getString("em_proj_cde2")%>";
                                       document.all.emp_pro_cde3.value = "<%=getAllInfo.getString("em_proj_cde3")%>";
                             <%}%>
                             }//close if (em_num_select == '<%=matchEmpNo%>')
              <%}// close hile(getEmpNo.next())%>
         }// close function pasteData(obj)

    Hi,
    This forum is exclusively for Sun Java Studio Creator.
    You may need to post this question at:
    http://forum.java.sun.com/forum.jspa?forumID=45
    Thanks,
    Creator Team.

  • How do I find the report server name, and then run paper report from forms?

    How do I find the report server name, and then run paper report from forms?
    I am having a problem running report 9i from forms 9i (see below thread). How do I find out the name of the report server? I checked my C:\ids\reports\conf directory but don't see anything that gives me the name of the reports server. I also don't have a iashome directory.
    Also, I just want to run the paper report (not the web version).
    Thanks.

    Hi,
    please read teh Forms / Reports integration paper in teh Collateral section for Oracle9i Forms at otn.oracle.com/products/forms
    In summary, you have to create an external Reports Service that you can then give a name.
    Frank

  • Xbox digital audio input and then output through MacBook digital audio port

    Hi,
    Sorry if this has been asked before but I'm trying to output a Dolby Digital (I think AC3) signal from my Xbox 360 into the MacBook's digital audio input and then output it through the digital audio output. I can output 5.1 sound from the MacBook itself but I can't get the Xbox audio to pass through. I don't know if the audio is at a sample rate not supported or needs decoding or what!
    Any help would be appreciated!

    If that doesn't work, I'm not quite sure.
    A combination of the Audio MIDI Utility (in Applications/Utilities), SoundSource, LineIn, and Soundflower (http://cycling74.com/products/soundflower/) might work, otherwise I'm stumped. Your best bet is probably a dedicated external USB or FireWire audio interface.

  • Controling movie to stop 10 sec -and then run again

    Hey
    I'm making a flv incl. a movie. I would like the movie to
    stop now and then (to put some animations on top of it) and then
    run after lets say 10 sec - this has to be timer controled. How do
    i script this in actionscript 2.0? and will I be able to use it
    again in the same flv?
    Thank you very much !
    br/jean

    Hello!
    Your best bet might be to try an interval that will unpause
    your movie after ten seconds or so. Just have it set the duration
    of the inteval as a parameter if you have difrent length of your
    pauses. If you need to determine when to pause the move you can use
    a listener to the time property of your NetStream object. Anyway,
    here is a simple way to pause:

Maybe you are looking for

  • Migrating 8.1.7.4 to 10.2: about apps

    Hi plp, I'm migrating my db 8i to 10g, and I have a lot of applications (I've done them with Oracle Forms 6i/10g) that work with the db. My question is... what kind of changes I must do in my apps for them to be perfectly compatible with the new 10.2

  • Permissions for File Connectio API

    Hi, I am developing a J2ME application which uses the file connection API of JSR75. My application does a lot of read and write on the files and it is very annoying to get the confirmation prompt. I know that signing my application with a third party

  • Is it possible to import xml into Adobe Muse to populate content similar to InDesign?

    Is it possible to import xml into Adobe Muse to populate content similar to InDesign?

  • Need help finding the Motherboard parts number on Ideacentre B520

    Hi guys, I'm currently repairing an ideacentre B520 for a customer and need to have the MB parts # to have the parts ordered.  i've found a white sticker with somes number on it but I don't know which one is the MB parts number. Here the number: 27*9

  • Ringtone runaround

    Ok, new iPhone 3gs, version 4.2.1. iTunes version 10.1.2.17 1. Went to the iTunes store bought 4 files titles "RINGTONES: xxxxxxxx" from the Ringtones section of the store. 2. Expected to see a ringtones tab in iTunes, didn't, fixed that in preferenc