PL/SQL (MOSC)

MOSC Banner

SQL script doesn't accept folder name in a variable

edited Feb 25, 2019 8:38AM in PL/SQL (MOSC) 12 commentsAnswered ✓

Hi there,

i wrote a simple sql script, that determine the database folder an store it in a variable (see code).

--- snip ---

-- Creating RedoLog file for a database instance

-- select statement gets the database folder

set echo off feedback off heading off underline off newpage none;

var f_name varchar2(513);

declare

  f_name varchar2(513) :='test123';

begin

   --select Name

   select distinct regexp_substr(name,'^.*\\') || 'redo4.log'

   into :f_name

   from v$datafile;

end;

/

Print :f_name;

ALTER DATABASE ADD LOGFILE GROUP 4 (:f_name) SIZE 250M;

--- snip ---

The variable "f_name" contains the folder and the filename of the redo log (M:\ORADATA\MYDATABASE\redo4.log).

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center