How to accept entries of user of the sql script

I want to create Tablespace using the sql script, but the location of the data file that I need to accept the user. (for the location of the data file).

How can I accept the user input to 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 the location of the user data file IE: "H:\ORACLE_DATA\FRSDB\TSPACE_INDI_D1_01.dbf".

Maybe something like this...

declare
  flocation varchar2(300) := '&Enter_The_Path';
begin
  EXECUTE IMMEDIATE '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';
end;

You will need to properly explain the quotes in your channel and also make sure you have spaces where they should be (for example, after the key word of the DATA file).

You'd better start with something like this:

set serverout on
declare
  flocation varchar2(300) := '&Enter_The_Path';
  v_sql varchar2(32767);
begin
  v_sql := '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(v_sql);
end;

and see what SQL it generates. When you're happy it generates a valid statement, then you can replace the statement dbms_output with your immediate statement execution.

Tags: Database

Similar Questions

  • Help! How to link to information users at the user page?

    I created the connection index, register, and sign the php pages. MySQL. Now I'm trying to create the user profile page. But I can't link their information to the user page. So, how to link to information users at the user page? @

    maniragav26 wrote:

    I created the connection index, register, and sign the php pages. MySQL. Now I'm trying to create the user profile page. But I can't link their information to the user page. So, how to link to information users at the user page? @

    Can I assume you are using Dreamweaver server behaviors (I guess if you ask this question, it is likely that you would be).

    Go to the mode code in your "login" page Find the section of code that creates the DW:

    $LoginRS__query = sprintf ("SELECT Uname, Pword OF USERS WHERE Uname = %s AND Pword = %s",

    GetSQLValueString ($loginUsername, "text"), GetSQLValueString ($password, "text"));

    $LoginRS = mysql_query ($LoginRS__query, $connUsers) or die (mysql_error ());

    $loginFoundUser = mysql_num_rows ($LoginRS);

    If {($loginFoundUser)

    $loginStrGroup = "";

    Declare two session variables and assign them

    $_SESSION ['MM_Username"] = $loginUsername;

    $_SESSION ["MM_UserGroup"] = $loginStrGroup;

    INSERT THE CODE in RED below: 'id' is the name of the id column in your database table - if it were 'user_id' that's what you have inserted.

    $LoginRS__query = sprintf ("SELECT users id Pword, Uname, Uname WHERE = %s AND Pword = %s",

    GetSQLValueString ($loginUsername, "text"), GetSQLValueString ($password, "text"));

    $LoginRS = mysql_query ($LoginRS__query, $connUsers) or die (mysql_error ());

    $loginFoundUser = mysql_num_rows ($LoginRS);

    $row_rsUserDetails = mysql_fetch_assoc ($LoginRS);

    If {($loginFoundUser)

    $loginStrGroup = "";

    Declare two session variables and assign them

    $_SESSION ['MM_Username"] = $loginUsername;

    $_SESSION ["MM_UserGroup"] = $loginStrGroup;

    Now to find the under section of code in the 'login' page: (this implies that you have defined a 'success' page to return IF the connection information is correct):

    If (isset($_SESSION['PrevUrl']) & false) {}

    $MM_redirectLoginSuccess = $_SESSION ["PrevUrl"];

    }

    Header ("Location:".) $MM_redirectLoginSuccess);

    }

    else {}

    Header ("Location:".) $MM_redirectLoginFailed);

    }

    INSERT THE CODE in RED below: 'id' in $row_rsUserDetails ['id']; is the name you gave the id column in your database user table, so if it was "user_id" it would read as - $row_rsUserDetails ['user_id'];

    If (isset($_SESSION['PrevUrl']) & false) {}

    $MM_redirectLoginSuccess = $_SESSION ["PrevUrl"];

    }

    $_SESSION ['id'] = $row_rsUserDetails ['id'];

    Header ("Location:".) $MM_redirectLoginSuccess);

    }

    else {}

    Header ("Location:".) $MM_redirectLoginFailed);

    }

    NOW, you create your user details page.

    Create a Recordset, select the table of database you want to gather information about the user. Select the filter to 'none '.

    Go to the view code and at the top of the page, insert:

    <>

    $userId = $_SESSION ['id'];

    ?>

    NEXT FIND THE CODE THAT SELECTS DATA FROM THE DATABASE: (your will be slightly different as you use different details of connection and recordset)

    @mysql_select_db ($database_connUsers, $connUsers);

    $query_rsUserDetails = "SELECT * FROM USERS";

    $rsUserDetails = mysql_query ($query_rsUserDetails, $connUsers) or die (mysql_error ());

    $row_rsUserDetails = mysql_fetch_assoc ($rsUserDetails);

    $totalRows_rsUserDetails = mysql_num_rows ($rsUserDetails);

    Change the second line above to: (add red code below for your SELECT string) (remember WHERE 'id' - 'id' is the name of the column in your database table.)

    $query_rsUserDetails = "SELECT * FROM users WHERE id = '". " $userId. » ' ";

    It's her!

    You can now start "liaison" details on the user Details page.

  • Effect of NLS_LANG in the SQL scripts

    DB version: 11.2.0.2
    Platform: RHEL 5.6


    We have a software provider who occasionally sends SQL scripts to deploy.

    The scripts contain usually few CFDS and many LMD

    Textpad, I can see, the LMD (inserts, updates) in the SQL Script. It usually contains some non-English characters (Dutch, German, French) as
    'Übersicht Buchungssätze' .
    'Fehler beim Löschen der zugeordneten Referenzen!'
    They always ask us set NLS_LANG as follows.
    export NLS_LANG="AMERICAN_AMERICA.WE8ISO8859P15"
    After INSERTION, I questioned the inserted values of PL/SQL Developer. Values appear exactly as it appears in the SQL Script text file as shown above.
    So, what was the effect of the NLS_LANG setting? What would have happened if I had not set NLS_LANG?


    NLS in the DB Info
    SQL > select * from nls_Database_parameters;
    
    PARAMETER                      VALUE
    ------------------------------ ----------------------------------------
    NLS_LANGUAGE                   ENGLISH
    NLS_TERRITORY                  UNITED KINGDOM
    NLS_CURRENCY                   #
    NLS_ISO_CURRENCY               UNITED KINGDOM
    NLS_NUMERIC_CHARACTERS         .,
    NLS_CHARACTERSET               AL32UTF8
    NLS_CALENDAR                   GREGORIAN
    NLS_DATE_FORMAT                DD-MON-RR
    NLS_DATE_LANGUAGE              ENGLISH
    NLS_SORT                       BINARY
    NLS_TIME_FORMAT                HH24.MI.SSXFF
    NLS_TIMESTAMP_FORMAT           DD-MON-RR HH24.MI.SSXFF
    NLS_TIME_TZ_FORMAT             HH24.MI.SSXFF TZR
    NLS_TIMESTAMP_TZ_FORMAT        DD-MON-RR HH24.MI.SSXFF TZR
    NLS_NCHAR_CHARACTERSET         AL16UTF16
    NLS_DUAL_CURRENCY              ?
    NLS_COMP                       BINARY
    NLS_LENGTH_SEMANTICS           BYTE
    NLS_NCHAR_CONV_EXCP            FALSE
    NLS_RDBMS_VERSION              11.2.0.2.0
    
    20 rows selected.

    If our supplier had chosen to save the script with the UTF-8 encoding, then, we have set NLS_LANG. Right?

    Evil. You need to AMERICAN_AMERICA. AL32UTF8. If you don't set NLS_LANG, it uses default AMERICAN_AMERICA. US7ASCII. Therefore, only pure ASCII 7-bit scripts can be executed in such environment. The Oracle Client does not use the default database character. It uses the platform default (usually US7ASCII) or UTF-16 in the case of JDBC, ODBC (Unicode mode) and ODP .NET pilots.

    -Sergiusz

  • call a batch file in the sql scripts

    Hi friends,
    I'm looking for a way to call any batch file in sql scripts. I avoid using the DBMS_SCHEDULER package because my application server and database server are deparaments.
    I use the sql script using the server.plz application.


    Ah, I see. Of course, this explains everything.

    Now to be serious: there is no way to run a batch SQL script. The Tools that present SQL statements to the database are often able to do; host in SQL * Plus may issue commands to the OS, the host of builtin forms is it too and with dbms_scheduler , you can run a shell script on the database server.

    So depending on the tools you use, there are several ways to run the OS commands. So far you didn't tell us what you want to do with what tools in the version you want to do. So to only answer is: it is not possible. You cannot run a simple SQL command script.

    see you soon

  • ADF security how do I add a user to the ldap.

    Hi all

    I am new to the safety of the ADF, in my case I want to create a secure application

    so I enable the adf on my application security. step is the following-

    1. create user

    2. General resources

    When the application runs request username and password valid user and grant them the page.

    but my question is that I created the user manually but

    How can I add users to the database table or ldap?

    Thank you

    Manish

    I use jdev version 11.1.1.5.0 and configure the security of the adf on my request to not find option 'identity Store' where Ldap is selected.

    Example of aiming is very old, so you do not have (and need not) this option. Just use the options for authentication or "Authentication and Authorization".

    and I have weblogic server that configure ldap server but how manage my application to use that ldap.

    When you set the identity on Weblogic server provider, all users and roles of this provider will be automatically available in all applications on this Weblogic domain.

    Dario

  • How do I add a user to the partner portal

    How can I add a user on our partner portal?

    Add the person you want to add to the partner portal as a user at one of the sites in your partner portal. Contact the BC (by chat or ticket) and let them know that you want to add user X to your partner portal, give them the email of the user and the site they are currently a user. BC will then add them.

  • How to remove the last session of the user of the SQL backend?

    Sometimes the user session gets closed between some of the work for any reason.

    When the next time that the user logs on P6, he gets an error or special functionaly dosen't work for this user or the system hangs.

    In this case if I decided to clear the history of the last session of this user from the databases, how to write the SQL query?

    I don't want to remove all user sessions in the table USESSION and USESSAUD, I just want to remove the last session of the user to particular user (e.g., XYZ).

    You can consult Re: currently connected users

  • How to give to all users in the domain?

    I want to any user with account in the field of access to a virtual machine. How to set the right to give the right to any user or all users in the domain?

    You should be able to search for users in the domain.

  • How to get feedback from users in the model layer?

    Hello

    I have a page with a table and a commandButton control. User can select several rows in the table and press the button. By pressing the button, I call a method in AppModuleImpl.java and pass the selected lines. inside the method I iterate over the selected lines and do something on each line. To do my job, I need a field, for example the date of birth field, has a value, but for certain lines of this field is empty and I want to get the value of the user. Now my question is how can I get user feedback in the model layer? (don't forget that I am inside the AppModuleImpl.java)

    Is it possible to open a dialog by program and get the value of the user if needed (i.e. If the row has the value)? If Yes, how should I do?

    JDev version: 11.1.1.4

    Thank you
    Will do

    In both cases the execution does not stop to view the context menu and the popup is displayed when the called managed bean method is completed

    Execution does not stop. That is right.

    "Modal dialog box" in terms of web simply means 'a dialogue box that blocks (more or less) user input until the dialog box is closed'. You think that a modal dialog is a dialog box that stops execution of your code until the dialog box is closed and then execution continues where you left it. There is no such thing in the web. Enforcement must continue, the demand must fill. When the user closes the dialog box, then it is a new application in.

    Thus, it is not as a modal dialog in Swing. You need to stop running yourself when you open the modal dialog box and continue your code when the next request comes, for example:
    You determine that a dialogue must be shown, you open the pop-up window and return. The listener to the dialog box, you then call a method that continues to do what you need to do according to the result of the dialog box.

    Sascha

  • How to create a new user at the presentation level

    Hello

    I would like to create a user account at the level of the presentation of a user to connect and view go them. I am connecting to the level of the presentation as an administrator and choosing configuration-> administration-> manage the presentation catalog groups and users. There is an option to create a group of catalog, how to create a user?

    Thank you

    Hi friend

    You can create the user on the Administration tool, on Manage-> Security-> users-> right click and then new user.

    Now, connect to the service of the presentation as an administrator. Then, on settings-> Administration-> catalog manage... here you can create new folder and grant access to the users of the folder you want.

    Kind regards.

    Published by: Hammett81 on August 2, 2010 17:54

  • How to do a validation based on the SQL query?

    Hello

    I have a requirement to perform a validation on a field (messageTextinput) in my page OAF.

    When I click the button apply, the value in this field is validated based on a SQL query (for example, the value in the field NOT IN (value1 select from table1).)

    Help, please.

    Best regards

    Joe

    1. create a SQL query based VO, XXVO. For example:-SQL query is select xx_table;

    2. Enter the "Apply" button click event in the controller and run the AM method passing the value entered by the user in the given field, for example:-value is VAL1

    3. in the method of the AM, get a handle of the VO, the whereClause and run.

    OAViewObjectImpl vo = findViewObject ("XXVO1"); XXVO1 is the name of the instance of the VO above, XXVO

    vo.executeEmptyRowSet ();

    vo.setWhereClause (null);

    vo.setWhereClause ("value =" + VAL1 + "'");

    vo.executeQuery ();

    If (VO. GetRowCount() > 0)

    A record is with the value of VAL1. Perform the required action

    I hope this helps.

  • How to close all windows after running the SaveAsPDF script?

    I ran into the problem where I adjusted the SaveAsPDF script to backup my PDF files with a preset specific PDF I use. But after executing the script, all newly created PDF files are open in illustrator and I have to close it manually one by one, choose if I want to 'Save' or 'do not save' (even if they are already registered). I would like for them to close right after that the PDF is created.

    I've added in the script:

    if (myFile.open("w")) {
      myFile.close(SaveOptions.DONOTSAVECHANGES);
      }
    

    Who's going to run the script and close the files, but for only 3 of the 10, I opened. The 7 remaining won't be saved or converted to PDF. Is there something wrong in my script or anything else that I can try to solve this problem?

    Here is my complete script:

    /** Saves every document open in Illustrator
      as a PDF file in a user specified folder.
    */
    
    
    // Main Code [Execution of script begins here]
    
    
    try {
      // uncomment to suppress Illustrator warning dialogs
      //app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
    
    
      if (app.documents.length > 0 ) {
    
    
      // Get the folder to save the files into
      var destFolder = null;
      destFolder = Folder.selectDialog( 'Select folder for PDF files.', '~' );
    
    
      if (destFolder != null) {
      var options, i, sourceDoc, targetFile;
    
      // Get the PDF options to be used
      options = this.getOptions();
      // You can tune these by changing the code in the getOptions() function.
    
      for ( i = 0; i < app.documents.length; i++ ) {
      sourceDoc = app.documents[i]; // returns the document object
    
      // Get the file to save the document as pdf into
      targetFile = this.getTargetFile(sourceDoc.name, '.pdf', destFolder);
    
      // Save as pdf
      sourceDoc.saveAs( targetFile, options );
    sourceDoc.close();
      }
    
    
      alert( 'Documents saved as MarkPreset PDF' );
      }
      }
      else{
      throw new Error('There are no document open!');
      }
    }
    catch(e) {
      alert( e.message, "Script Alert", true);
    }
    
    
    /** Returns the options to be used for the generated files.
      @return PDFSaveOptions object
    */
    function getOptions()
    {var NamePreset = 'MarkPreset'; 
      // Create the required options object
      var options = new PDFSaveOptions();
      options.pDFPreset=NamePreset; 
    
    
      // See PDFSaveOptions in the JavaScript Reference for available options
    
      // Set the options you want below:
    
    
      // For example, uncomment to set the compatibility of the generated pdf to Acrobat 7 (PDF 1.6)
      // options.compatibility = PDFCompatibility.ACROBAT7;
    
      // For example, uncomment to view the pdfs in Acrobat after conversion
      // options.viewAfterSaving = true;
    
      return options;
    }
    
    
    /** Returns the file to save or export the document into.
      @param docName the name of the document
      @param ext the extension the file extension to be applied
      @param destFolder the output folder
      @return File object
    */
    function getTargetFile(docName, ext, destFolder) {
      var newName = "";
    
    
      // if name has no dot (and hence no extension),
      // just append the extension
      if (docName.indexOf('.') < 0) {
      newName = docName + ext;
      } else {
      var dot = docName.lastIndexOf('.');
      newName += docName.substring(0, dot);
      newName += ext;
      }
    
      // Create the file object to save to
      var myFile = new File( destFolder + '/' + newName );
    
      // Preflight access rights
      if (myFile.open("w")) {
      myFile.close(SaveOptions.DONOTSAVECHANGES);
      }
      else {
      throw new Error('Access is denied');
      }
      return myFile;
    }
    

    Try this change

    for (i = 0; i< app.documents.length;="" i++="" ) ="">

    for (i = app.documents.length; i > 0; i--)

  • How to assign the variable in the SQL script?

    I have the below running to generate the XML from the file.
    set long 100
    set pages 0
    set trimspool on
    set serveroutput on
    set echo off
    set terminal off
    variable out CLOB
    begin
            pack.proc('&&1','&&2',:out);
    end;
    /
    spool /dir/loc/file1.xml
    select :out from dual;
    spool off
    I'm queue in the order of the coil, the output to a file named file1.xml. I invoke this SQL script from a shell script, I will pass variable association 3rd since the shell script which I want to use in the file ' & & 3'.xml. Help me set this variable to the DIGITAL field in this SQL script and how can I add to the command of the coil?
    set long 100
    set pages 0
    set trimspool on
    set serveroutput on
    set echo off
    set terminal off
    variable out CLOB
    define var1='&1' -- to allow for more readable code
    define var2='&2'
    define var3 ='&3'
    begin
            pack.proc('&var1','&var2',:out);
    end;
    /
    spool /dir/loc/file&var3..xml -- note the substition variable has  . appended
    print out
    spool off
    

    ------------
    Sybrand Bakker
    Senior Oracle DBA

  • How to force a return, even if the sql cannot find a record

    Hello
    I ' l try explan, what I'm looking for:
    I have a SQL query (Oracle 10 g) as

    Select system, A, B T where system = 0

    In the table T is no record with system = 0, so I don't get anything back from the SQL. It's OK, but I need to get something like * 0, "," * as a return. I tried with NVL(SysT,0)... but it seems not to be the solution.

    Does anyone has an idea how to solve this problem?

    Best regards
    Carsten

    Hi, Carsten,

    Another way to do this is to use an outer join:

    SELECT  0 AS SysT, a, b
    FROM               dual
    LEFT OUTER JOIN  t    ON  t.SysT  = 0
    ;
    

    UNION, Saurabh suggested, is a way to do it. If the combination (System, a, b) is not unique in table t, then you need to make UNION ALL , which is more efficient anyway, to avoid losing lines.
    If the original query is longer than what you have posted, you will not want to repeat. Write it only once, in a WITH clause, like this:

    WITH       original_query     AS
    (
         SELECT  SysT, a, b
         FROM      t
         WHERE      SysT     = 0
    )
    SELECT     *
    FROM     origianl_query
        UNION ALL
    SELECT     0 AS SysT, a, b
    FROM     dual
    WHERE     NOT EXISTS  (
                          SELECT     1
                   FROM     original_query
                      )
    ;
    

    Regardless of how complicated the original query, the EXISTS subquery is just 'SELECT 1 FROM original_query '.

    Published by: Frank Kulash, December 19, 2011 06:21

  • How to pass arguments to the SQL Script in command prompt

    I don't know about the ' & nom_de_variable "to request a value in the command line.

    But, how can I pass arguments from the command line for the following script to the command - prompt

    Example:

    ex_proc. SQL

    CREATE OR REPLACE PROCEDURE ex_proc (employee_id NUMBE IN)
    IS
    v_emp_id Number (38);
    BEGIN

    v_emp_id: = employe_id;

    UPDATE emp_employee SET sal = 2000 WHERE emp_id = v_emp_id;

    END;
    /


    call_ex_proc. SQL

    Appellant for procedure above:

    BEGIN

    ex_proc (100); -The employee id is 100.

    END;
    /

    Here are the General controls that we use to run the scripts above-

    SQL > @ex_proc.sql

    SQL > @call_ex_proc.sql



    But my requirement is to pass the employee id as an argument in the command line as.
    SQL > @call_ex_proc.sql 100

    Is it possible to pass command line arguments?

    Usually this question start with reading documentation, wouldn't it?

    Solomon Yakobson showed you the method gross and unreadable.

    You will use best

    set = '& 1' '.

    -use & in the rest of the code

    ----------
    Sybrand Bakker
    Senior Oracle DBA

Maybe you are looking for