Out Variable of PL/SQL into UNIX environment
Hallo,
I'd like to pass an out variable from a PL/SQL package to an UNIX environment!
Is this possible?
Thanks,
Hello Shankar,
Thank you for your instant reply.
Thanks to you, I can write the sample code that works fine.
I understand that calling setMaxParamSize() before calling setString() is very important.
Below is the final sample code that works fine.
std::string sql4 = "BEGIN test4_proc(:1); END;";
std::string result;
Statement* stmt4 = conn->createStatement(sql4);
stmt4->setMaxParamSize(1, 12); // Important!! Call before setXXX()
stmt4->setString(1, "Hello");
stmt4->executeUpdate();
result = stmt4->getString(1);
std::cout << "result : <" << result << ">" << std::endl;
Thank you.
Similar Messages
-
Handling variable flat file name in UNIX environment
Dear Forum,
I am working in a project where,
Online systems generate flat files with variable names (followed by timestamp) and load into a Unix directory (FTP Location) for loading into data warehouse.
Using OWB, I will have to rename those files into a static name then execute the mapping. Once the mapping is executed the the source file should be transfered to a different directory.
I am trying to do this using a external process in OWB process flow. I found a similar reference in the link below
http://www.oracle.com/technology/products/warehouse/pdf/Cases/case7.pdf
But here it is shown for windows only. As I do not know unix, I could not proceed a lot with this.
Therefore requesting you all, please help me showing how can I achive this. I think your answer will help many others along with me, looking for the same solution. Please help.
Kind Regads
ZakirYou will need to logon as your Oracle owner (the userid is ORACLE, in my case), and then issue the following commands from a terminal session:
To create a new reports server (one in addition to the default
in-process server), use the following commands:
export ORACLE_HOME=<whatever your oracle home path is>
cd $ORACLE_HOME/bin
./rwserver.sh <newserver name>
To start the new server, issue:
./rwserver.sh server=<newserver name>
Leave the Unix session that was used to start the server logged on unless you have something like DTWM running that will keep the server running. Otherwise, if you log off the unix session, the server will end.
Then just substitute the new server name in your line command. The difference between the in-process server and a standalone server is that the in-process server will not always stay active - it will start when it receives a request. The standalone server will stay active all the time and wait for requests.
If the standalone server works for you, I would suggest then putting it in the correct config files to let Enterprise Manager manage it for you. If you get that far, let me know and I can tell you how to do that also. (Plus the instructions are in the Publishing Reports To The Web manual). -
Hi,
Still i was a pl/sql programmer in windows platform. Now a sudden requirement to work pl/sql in unix environment. I very much new to unix. I dont know how to proceed. Please suggest start point where should i start...please help me
thanks
aspThanks sharma,
'You are welcome.'>
U have been a good experienced person in this forums
'I do not want to take this comment. In fact, I would not deserve it'
'My experience is just 3 years in the S/W industry and full-time Oracle is '
' just less than that. But I deliberately wanted to participate actively in'
' this forum to gain knowledge from the other GURUs. But anyway thanks'
' your responses to a member in the forum.'
whether i have to learn any unix
specific os commands or no need of unix os command
knowledge.
'This depends on your work. If it purely for Oracle, then you do not have to'Cheers
Sarma. -
How to pass Unix environment variable to a SQL procedure or SQL * Plus
Can any body suggest me how to ,
How to pass Unix environment variable to a SQL procedure or SQL * Plus file..
I am trying to invoke a SQL Procedure from Unix
by passing the value of a Unix environment variable.
Is it possible..?
Thanks in advance.
Regards,
Srinivas JaltaruWithin your shell script you can use what is known as a "here document" which is basically a way of wrapping a call to Oracle. The following call to Oracle loops and writes rows to files with numerically increasing file names. Two unix shell variables are used, one in a select statement and one in a spool command :
<pre>
#!/bin/bash
export ORACLE_SID=DEV05
FILENO=1007351
while [ ${FILENO} -le 1008400 ]
do
FILENAME=farm_${FILENO}.txt
DUMMY=`sqlplus -s user20/user20 <<SQLSTOP
set lines 73
set pages 0
set head off
set termout off
set echo off
set feedback off
select rpad(searchx, 8)
from blastx@PRODUCTION
where searchx = ${FILENO} ### here's a shell variable
spool /export/home/user20/sql/psiblast/BACKUP2_D/${FILENAME} ### here's a shell variable
spool off
SQLSTOP`
FILENO=`expr ${FILENO} + 1`
done
exit 0
</pre> -
Fetching UNIX environment variables
Does anyone know of a way to fetch a UNIX environment variable into a PL/SQL variable?
Thanks
KerriHi Dave
If you are just running through the conc manager as a regular report you can not do this. At the CM layer publisher is not aware of nor can it be passed environment variables.
If you are on 11.5 why not store the sub template in the template manager and then use our URI to reference it:
xdo://APPCODE.TEMPLCODE.LANG.TERR
Check the user guide.
Regards
Tim -
OMB PLUS - Problem passing Unix environment variables to OMBPlus
Due to a requirement to encapsulate deployment of OWB applications, we currently start OMBPlus.sh from our own wrapper ksh script (deploy.ksh) in order to get the new / changed application into the target control center etc.
We now have a new requirement that means we need to pass the content of the Unix environment across to OMBPlus.sh (and from thence into our deployment tcl scripts).
No problem, if you believe the tcl documentation. The entire Unix environement gets dumped into a hash array called 'env', so you can get the variable's value out just by saying $env(unix_valraible).
Sounds great, it should work a treat.
Except OMBPlus only silghtly resembles tclsh.
The 'env' that gets into OMBPlus bears practically no resemblance to the 'env' that existed before OMBPlus.sh got invoked.
Does anyone have:
a decent explanation for why the env gets scrambled (and how to avoid it) ?
or an alternative method of getting the Unix environment varaible values into OMBPlus ?
Please do not propose passing them all on the command line because (would you beleive it) the values are database passwords !
Edited by: user10466244 on 23.10.2008 09:28Unfortunately, the java implementation of TCL that Oracle used as the basis for OMB+ is NOT a fully-featured implementation. Just try using packages...
However, and understanding why you don't want to hard-code passwords into a file, you can always edit the setowbenv.sh file in your owb/bin/unix directory to grab your specific shell environment variables and propogate them to the java session.
towards the bottom of this env file you will see a section that looks something like:
JDK_HOME=../../../jdk
OWB_HOME=/owb
ORA_HOME=/owb
OEM_HOME=/owb
IAS_HOME=/owb
ORACLE_HOME=/owb
CLASSPATH=Personalties.jar:../admin:$MIMB_JAR:
CLASSPATH_LAUNCHER="-classpath ../admin:../admin/launcher.jar:$CLASSPATH: -DOWB_HOME=$OWB_HOME -DJDK_HOME=$JDK_HOME -DORA_HOME=$ORA_HOME -DOEM_HOME=$OEM_HOME -DIAS_HOME=$IAS_HOME -Doracle.net.tns_admin=$ORA_HOME/network/admin Launcher ../admin/owb.classpath"
export ORA_HOME
export OWB_HOME
export JDK_HOME
export OEM_HOME
export IAS_HOME
export ORACLE_HOME
You could add in the environment variables that you want propogated, include them into the CLASSPATH_LAUNCHER, and then they will turn up in your OMB+ session env array.
e.g., to propgate an environment variable called MY_DATABASE_PASSWORD you would:
JDK_HOME=../../../jdk
OWB_HOME=/owb
ORA_HOME=/owb
OEM_HOME=/owb
IAS_HOME=/owb
ORACLE_HOME=/owb
CLASSPATH=Personalties.jar:../admin:$MIMB_JAR:
CLASSPATH_LAUNCHER="-classpath ../admin:../admin/launcher.jar:$CLASSPATH: -DOWB_HOME=$OWB_HOME -DMY_DATABASE_PASSWORD=${MY_DATABASE_PASSWORD} -DJDK_HOME=$JDK_HOME -DORA_HOME=$ORA_HOME -DOEM_HOME=$OEM_HOME -DIAS_HOME=$IAS_HOME -Doracle.net.tns_admin=$ORA_HOME/network/admin Launcher ../admin/owb.classpath"
export ORA_HOME
export OWB_HOME
export JDK_HOME
export OEM_HOME
export IAS_HOME
export ORACLE_HOME
So now you have no protected data hardcoded, it will pick up your specific environment variables at runtime, and when you start OMB+ you will be able to:
array get env MY_DATABASE_PASSWORD.
cheers,
Mike -
Script fails when passing values from pl/sql to unix variable
Script fails when passing values from pl/sql to unix variable
Dear All,
I am Automating STATSPACK reporting by modifying the sprepins.sql script.
Using DBMS_JOB I take the snap of the database and at the end of the day the cron job creates the statspack report and emails it to me.
I am storing the snapshot ids in the database and when running the report picking up the recent ids(begin snap and end snap).
From the sprepins.sql script
variable bid number;
variable eid number;
begin
select begin_snap into :bid from db_snap;
select end_snap into :eid from db_snap;
end;
This fails with the following error:
DB Name DB Id Instance Inst Num Release Cluster Host
RDMDEVL 3576140228 RDMDEVL 1 9.2.0.4.0 NO ibm-rdm
:ela := ;
ERROR at line 4:
ORA-06550: line 4, column 17:
PLS-00103: Encountered the symbol ";" when expecting one of the following:
( - + case mod new not null <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current exists max min prior sql stddev sum variance
execute forall merge time timestamp interval date
<a string literal with character set specification>
<a number> <a single-quoted SQL string> pipe
The symbol "null" was substituted for ";" to continue.
ORA-06550: line 6, column 16:
PLS-00103: Encountered the symbol ";" when expecting one of the following:
( - + case mod new not null <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current exists max min prior sql stddev su
But when I change the select statements below the report runs successfully.
variable bid number;
variable eid number;
begin
select '46' into :bid from db_snap;
select '47' into :eid from db_snap;
end;
Even changing the select statements to:
select TO_CHAR(begin_snap) into :bid from db_snap;
select TO_CHAR(end_snap) into :eid from db_snap;
Does not help.
Please Help.
TIA,
NischalHi,
could it be the begin_ and end_ Colums of your query?
Seems SQL*PLUS hs parsing problems?
try to fetch another column from that table
and see if the error raises again.
Karl -
How can I execute a Procedure with OUT variable is %ROWTYPE on SQL Prompt
Hi,
I have a procedure with OUT variable is %ROWTYPE
How can I execute the following procedure on SQL prompt.
(without creating anonymous block)
CREATE OR REPLACE PROCEDURE zz_sp_EMP(VEMPNO IN EMP.EMPNO%TYPE,
V_REC IN OUT EMP%ROWTYPE)
AS
BEGIN
SELECT * INTO V_REC FROM EMP WHERE EMPNO = VEMPNO;
END;
Thanks & Regards,
Nareshas previous posters said: it's not possible to do this without declaring a variable in the anonymous block.
With anonymous block it would look like this (had to change it a bit, since i'm using hr-schema on oracle XE):
declare
l_rec EMPLOYEES%ROWTYPE;
begin
zz_sp_EMP(VEMPNO => 100, V_REC => l_rec);
DBMS_OUTPUT.PUT_LINE ( 'first_name = ' || l_rec.first_name );
DBMS_OUTPUT.PUT_LINE ( 'last_name = ' || l_rec.last_name );
end;
first_name = Steven
last_name = King -
Please help. Thank you for your time and expertise.
Prerequisites: sql query needs to be a view. Real view is more than recursion. It computes location path, is used in JOINs and returns this path.
Problem: no matter what I tried, sql server does not produce 'index seek' when using variable but does with literal.
See full reproduction code below.
I expect that query SELECT lcCode FROM dbo.vwLocationCodes l WHERE l.lcID = @lcID will seek UNIQUE index but it does not.
I tried these:
1. Changing UX and/or PK to be CLUSTERED.
2. query OPTION(RECOMPILE)
3. FORCESEEK on view
4. SQL Server 2012/2014
5. Wrap it into function and CROSS APPLY. On large outer number of rows this just dies, no solution
but to no avail. This smells like a bug in SQL Server. I am seeking your confirmation.
I am thinking it is a bug as variable value is high-cardinality, 1, and query is against unique key. This must produce single seek, depending if clustered or nonclustred index is unique
Thanks
Vladimir
use tempdb
BEGIN TRAN
-- setup definition
CREATE TABLE dbo.LocationHierarchy(
lcID int NOT NULL ,
lcHID hierarchyid NOT NULL,
lcCode nvarchar(25) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
lcHIDParent AS lcHID.GetAncestor(1) PERSISTED,
CONSTRAINT PK_LocationHierarchy_lcID PRIMARY KEY NONCLUSTERED (lcID ASC),
CONSTRAINT UX_LocationHierarchy_pltID_lcHID UNIQUE CLUSTERED (lcHID ASC)
-- add some data
INSERT INTO dbo.LocationHierarchy
VALUES
(1, '/', 'A')
,(2, '/1/', 'B')
,(3, '/1/1/', 'C')
,(4, '/1/1/1/', 'D')
--DROP VIEW dbo.vwLocationCodes
GO
CREATE VIEW dbo.vwLocationCodes
AS
WITH ru AS
SELECT
lh.lcID
,lh.lcCode
,lh.lcHID
,CAST('/' + lh.lcCode + '/' as varchar(8000)) as LocationPath
-- to support recursion
,lh.lcHIDParent
FROM dbo.LocationHierarchy lh
UNION ALL
SELECT
ru.lcID
,ru.lcCode
,ru.lcHID
,CAST('/' + lh.lcCode + ru.LocationPath as varchar(8000)) as LocationPath
,lh.lcHIDParent
FROM dbo.LocationHierarchy lh
JOIN ru ON ru.lcHIDParent = lh.lcHID
SELECT
lh.lcID
,lh.lcCode
,lh.LocationPath
,lh.lcHID
FROM ru lh
WHERE lh.lcHIDParent IS NULL
GO
-- get data via view
SELECT
CONCAT(SPACE(l.lcHID.GetLevel() * 4), lcCode) as LocationIndented
FROM dbo.vwLocationCodes l
ORDER BY lcHID
GO
SET SHOWPLAN_XML ON
GO
DECLARE @lcID int = 2
-- I believe this produces bad plan and is defect in SQL Server optimizer.
-- variable value cardinality is 1 and SQL Server should know that. Optiomal plan is to do index seek with key lookup.
-- This does not happen.
SELECT lcCode FROM dbo.vwLocationCodes l WHERE l.lcID = @lcID -- bad plan
-- this is a plan I expect.
SELECT lcCode FROM dbo.vwLocationCodes l WHERE l.lcID = 2 -- good plan
-- I reviewed these but I need a view here, can't be SP
-- http://sqlblogcasts.com/blogs/tonyrogerson/archive/2008/05/17/non-recursive-common-table-expressions-performance-sucks-1-cte-self-join-cte-sub-query-inline-expansion.aspx
-- http://social.msdn.microsoft.com/Forums/sqlserver/en-US/22d2d580-0ff8-4a9b-b0d0-e6a8345062df/issue-with-select-using-a-recursive-cte-and-parameterizing-the-query?forum=transactsql
GO
SET SHOWPLAN_XML OFF
GO
ROLLBACK
Vladimir MoldovanenkoHere is more... note that I am creating table Items and these can be in Locations.
I am trying LEFT JOIN and OUTER APLLY to 'bend' query into NESTED LOOP and SEEK. There has to be nested loop, 2 rows against 4. But SQL Server fails to generate optimal plan with SEEK. Even RECOMPILE does not help
use tempdb
BEGIN TRAN
-- setup definition
CREATE TABLE dbo.LocationHierarchy(
lcID int NOT NULL ,
lcHID hierarchyid NOT NULL,
lcCode nvarchar(25) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
lcHIDParent AS lcHID.GetAncestor(1) PERSISTED,
CONSTRAINT PK_LocationHierarchy_lcID PRIMARY KEY NONCLUSTERED (lcID ASC),
CONSTRAINT UX_LocationHierarchy_pltID_lcHID UNIQUE CLUSTERED (lcHID ASC)
-- add some data
INSERT INTO dbo.LocationHierarchy
VALUES
(1, '/', 'A')
,(2, '/1/', 'B')
,(3, '/1/1/', 'C')
,(4, '/1/1/1/', 'D')
--DROP VIEW dbo.vwLocationCodes
GO
--DECLARE @Count int = 10;
--WITH L0 AS (SELECT N FROM (VALUES(1),(1),(1),(1),(1),(1),(1),(1),(1),(1)) N (N))-- 10 rows
--,L1 AS (SELECT n1.N FROM L0 n1 CROSS JOIN L0 n2) -- 100 rows
--,L2 AS (SELECT n1.N FROM L1 n1 CROSS JOIN L1 n2) -- 10,000 rows
--,L3 AS (SELECT n1.N FROM L2 n1 CROSS JOIN L2 n2) -- 100,000,000 rows
--,x AS
-- SELECT TOP (ISNULL(@Count, 0))
-- ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) as Number
-- FROM L3 n1
--SELECT Number as itmID, NTILE(4)OVER(ORDER BY Number) as lcID
--INTO dbo.Items
--FROM x
----ORDER BY n1.N
--ALTER TABLE dbo.Items ALTER COLUMN itmID INT NOT NULL
--ALTER TABLE dbo.Items ADD CONSTRAINT PK PRIMARY KEY CLUSTERED (itmID)
CREATE TABLE dbo.Items (itmID int NOT NULL PRIMARY KEY, lcID int NOT NULL)
INSERT INTO dbo.items
VALUES(1, 1)
,(2, 3)
GO
CREATE VIEW dbo.vwLocationCodes
AS
WITH ru AS
SELECT
lh.lcID
,lh.lcCode
,lh.lcHID
,CAST('/' + lh.lcCode + '/' as varchar(8000)) as LocationPath
-- to support recursion
,lh.lcHIDParent
FROM dbo.LocationHierarchy lh
UNION ALL
SELECT
ru.lcID
,ru.lcCode
,ru.lcHID
,CAST('/' + lh.lcCode + ru.LocationPath as varchar(8000)) as LocationPath
,lh.lcHIDParent
FROM dbo.LocationHierarchy lh
JOIN ru ON ru.lcHIDParent = lh.lcHID
SELECT
lh.lcID
,lh.lcCode
,lh.LocationPath
,lh.lcHID
FROM ru lh
WHERE lh.lcHIDParent IS NULL
GO
-- get data via view
SELECT
CONCAT(SPACE(l.lcHID.GetLevel() * 4), lcCode) as LocationIndented
FROM dbo.vwLocationCodes l
ORDER BY lcHID
GO
--SET SHOWPLAN_XML ON
GO
DECLARE @lcID int = 2
-- I believe this produces bad plan and is defect in SQL Server optimizer.
-- variable value cardinality is 1 and SQL Server should know that. Optiomal plan is to do index seek with key lookup.
-- This does not happen.
SELECT lcCode FROM dbo.vwLocationCodes l WHERE l.lcID = @lcID-- OPTION(RECOMPILE) -- bad plan
-- this is a plan I expect.
SELECT lcCode FROM dbo.vwLocationCodes l WHERE l.lcID = 2 -- good plan
SELECT *
FROM dbo.Items itm
LEFT JOIN dbo.vwLocationCodes l ON l.lcID = itm.lcID
OPTION(RECOMPILE)
SELECT *
FROM dbo.Items itm
OUTER APPLY
SELECT *
FROM dbo.vwLocationCodes l
WHERE l.lcID = itm.lcID
) l
-- I reviewed these but I need a view here, can't be SP
-- http://sqlblogcasts.com/blogs/tonyrogerson/archive/2008/05/17/non-recursive-common-table-expressions-performance-sucks-1-cte-self-join-cte-sub-query-inline-expansion.aspx
-- http://social.msdn.microsoft.com/Forums/sqlserver/en-US/22d2d580-0ff8-4a9b-b0d0-e6a8345062df/issue-with-select-using-a-recursive-cte-and-parameterizing-the-query?forum=transactsql
GO
--SET SHOWPLAN_XML OFF
GO
ROLLBACK
Vladimir Moldovanenko -
Pass a Value to Variable from the unix environment in ODI (ELT)
Hi
i am very new to ODI environment.
i want know how to pass a value to variables in oracle data integrator from unix environment.
Example:
Variable name : Sales
for variable name sales i want to pass the value from unix environment.
Regards,
Raj
Edited by: user11137587 on Aug 19, 2009 6:26 AMWork Around !
You can execute OS commands using Jython script. Probably you need to flush your enviornment variables value into a file using jython script and then read those value into ODI variable from the file.
BUt may I know why you want to read environment variable vaules in ODI, Dont you think this will make your application less portable
Regards,
Amit -
APEX - accepting OUT variable values from PL/SQL Stored Procedure
I have created a page (Form) which is accepting values text fields.
In the Page Processing section under Processing, I am passing the values to a PL/SQL Stored Procedure, which acts like an API. The procedure contains code to validate the entered data and finally insert the data into the base tables. The procedure also contains OUT variables in the parameter that would return status of processing and any error messages.
Now, my question is, how can I make the page accept these OUT variables from the procedure. What I wish to do is, to capture these messages/processing status from the procedure in the page. For example, if there is a error in the data and the procedure is sending this message in the OUT variable, I need this to be displayed on the page as an error message.
Is this possible in APEX?
Regards,
Santhosh JoseHi VC,
I just tried putting the string directly instead of the variable. Its still not giving me the expected results.
HOWEVER, I think the reason was because of the EXCEPTION block in my code. I have an EXCEPTION block to handle exceptions. I commented the WHEN OTHERS section and now the error message is coming on the page.
So what I have done now is as follows: At the point at which the error is expected, I am raising a handled exception. And within the exception handling, I am giving RAISE_APPLICATION_ERROR.
WHEN ex_main_error*
THEN*
p_status := 2;*
p_msg := 'ERROR Stage: '||lc_err_stage||' ERROR Message: '||lc_err_msg;*
RAISE_APPLICATION_ERROR (-20001, p_msg);*
This is working now! Which is very good news. Thanks once again for your help!
Regards,
Santhosh Jose -
Convert word into html in unix environment
We are in the process of developing a coldfusion web
application which allows the users to upload resumes in word
format. Once the word document is uploaded we need to convert the
word document into html on the fly. We know it can be accomplished
using com object in the windows platform. But ours is a unix
environment. We need some coldfusion coding which can convert the
uploaded word file into html. Please take note coldfusion server
runs on unix platform in our case.For step 3 call a 3rd party component such as Aspose.Words to
handle converting test.doc to test.html. I'd recommend wrapping
this logic inside a CFC.
For example using Aspose.Words java object appears to be as
easy as the Java code:
Document doc = new Document(getMyDir() + "Document.doc");
doc.save(getMyDir() + "Document.ConvertToHtml Out.html",
SaveFormat.HTML);
Note: I've used the .NET version of Aspose.Words, not the
Java version, but I've been pleased with the product.
Aspose.Words formats supported
http://www.aspose.com/documentation/file-format-components/aspose.words-for-.net-and-java/ com/aspose/words/saveformat.html
You might also investigate Apache POI
http://poi.apache.org/ -
Environment variable PATH and Sql*Plus
Hi all,
i have a problem with sqlplus.
It might seem not to be able to read the path environment variable.
I need to launch some sqls without typing their path (to put the path i should modify morre than 300 shell scripts), e.g.: @script.sql.
My shell scripts are invoked by the database using java.
Inside the shell scripts we have commands like "sqlplus -silent <login> @script.sql [parameters]"
So if sqlplus is not able to read the PATH environment variable, the command hangs waiting for something to do without the chance to close it.(it is silent).
I run RDBMS v8.1.7 on compaq tru64 Unix.
Can someone help me??
Thanks in advance.
Marco - Milan, ItalyWhere do I set SQL*Plus SQLPATH variable??As every other unix environment variable - either in your profile or in your current shell whatever you like
Is this the PATH where SQL*Plus searches for .sql
files??SQL*Plus searches for your files in your current directory, and then the directories you specify with the SQLPATH environment variable.
SQL*Plus searches this colon-separated list of directories in the order they are listed. -
How do I use a UNIX environment variable for the path of a file name
We are running Forms 6i over the web. The forms server runs on a UNIX (HP-UX) machine.
I want to read the contents of a file, which is simple enough, using the TEXT_IO package. However, I want to reference a UNIX environment variable that specifies the file path i.e
PROCEDURE get_file IS
in_file Text_IO.File_Type;
linebuf VARCHAR2(1800);
filename VARCHAR2(200);
BEGIN
filename:= '$LOG_DIR/RCAS181.log';
in_file := Text_IO.Fopen(filename, 'r');
.....other stuff
Notice the filename string references my unix env variable '$LOG_DIR'. However, this doesnt work. If I put the full pathname it works fine.
Any suggestions ?Have a look at TOOL_ENV.GETVAR()
-
Can i use a environment variable inside a *.sql file?
Hello,
I want to create a external table.
So i am using the command
create or replace directory abc as 'C:\folder'.... inside a sql file.
Now i want the path "C:\folder" to be dynamic as i am using this path in many other places also inside the sql file.So i thought to create a environment variable and put this value there.I tried using as %PATH% but it gives error..... where %PATH%=C:\folder.
Can i use a environment variable inside a *.sql file?
But how to do that or is there any other way.
Thanks
Swapna
Edited by: user11018268 on Feb 19, 2010 1:03 AMuser11018268 wrote:
Actually what i want is the path "C:\folder" is not fixed it can be anything which i may not know the user may decide it later. Not supported. A directory object refers to a specific physical location (directory/folder) on a file system. Not a path.
You can work around it by (creating and) using a function (running under a super user schema with authid definer privs). The caller (e.g. schema scott ) calls it with a physical path. E.g. GetDirectoryObject( 'C:\folder\2010\feb\week4' ).
This function determines if there is an existing directory object for the path. If not, it uses a wildcard search to determine if there are any directory objects for parents in the path (e.g. for C:\folder\2010\feb or C:\folder\2010 or C:\folder ).
If it finds a directory object, it interrogates the data dictionary to determine if the caller, schema scott for example, has read/write access on that directory object. If it has, it creates a new directory object and grants the caller read/write access to it. The function then returns the name of the directory object to the caller.
The caller thus do not deal directly with directory objects. The function returns the object name given a physical path as input. Also, only a single base directory needs to be created (e.g. for C:\folder ) and access granted to the schema on it. Any sub-directory in that base directory can now be dynamically accessed by the schema.
Maybe you are looking for
-
I can't log into icloud from my Windows 8 PC, but I can from my Windows XP PC
I had my old Vista PC upgraded to Windows 8. I just tried to log into www.icloud.com, but after entering my username and my password nothing happens. No errors, nor messages. Fortunately, I can remotely log into my work PC which is a Windows XP.
-
Sign in error 'There was an error with this action. Try again later.'
Get an error message when trying to log into CC to download my initial apps. Purchased from Amazon and the process completed successfully until I attempted to log in and down load from adobe.com. had to create new adobe account just to post this ques
-
Macbook Pro 3,1 upgrade RAM to 6GB any reference brand memory?
Hi, anyone had upgrade their Macbook Pro (3,1 - 2.4GHz) RAM's become 6GB (1x4GB & 1x2GB) ? Any complain so far about the performance? Any reference what branded is recommended? OWC? Kingston? I plan to upgrade to 4GB or 6GB(if there is no complain ab
-
Hi All, When I run my report using Report builder 6i, it runs fine whereas I try to run using oracle apps it gives the below error "REP-1219: 'M_12' has no size -- length or width is zero" As said by one of the users in one of the old thread, i tried
-
Dynamically populate the text propert of the Button in JSP
Hello, I have the following code in the doInitialization() method: IPortalComponentRequest request =((IPortalComponentRequest)this.getRequest()); myBean = new MyBean(); myBean.setText("Submit"); request.getComponentSession().p