Scope of global & pl/sql variable in open_form with new session
Hi,
What will be the scope of the Oracle forms global variable & variable declared in a pl/sql pckage, if the value in these variable is updated from the Oracle Form GUI, if the form is opend by using the open_form method with new session or Active session.
My requirement is , I developed one application with custom user login name & password - not the Oracle username & password.
But I need to track the user actions on the forms - Inser/Update/Delete action, for this i included user_name as one of the column in the base table, and from the form, initialise this field with login user name.
I implemented this in the trigger of the base table. But for delete, I am not getting the user name who deleted, only getting the user who created this record, because :NEW is not in scope for after delete trigger. So for the delte, I created a variabe in a PL/SQL package, and created two procedure to set & get the user name to that variable, and from the Form, before delete by using the set method I assign the current login user name to the variable, and in the trigger by using the get() get the user name from the variable, So far this is working fine, my doubt is What will be the value in the variable, if two different user made delete action from at a same time, Whether first user name will be replace with second one, or this variable will be in different session, If I opened the forms by using SESSION parameter. Also can I use Oralce Forms global varaible instead of the PL/SQL varibale.
Thank in advance.
Thanks Andreas,
I did the same way. But my doubt is All the user login will be in different session, I mean, Whether the vairable used to store the user name will be in different session to each Oracle Forms user, it wont overwrite one user name with the next login user name.
-- Copied from you old message:
<<On the forms-side after the login, call PK_USER.PR_SET_USER(THE_USER_TAKEN_FROM_SOMEWHERE);
In your db-triggers where you actually use something like USER, use PK_USER.FK_GET_USER instead>>
Thanks
Rizly
Similar Messages
-
Globals and Open_Form with new session
How are Globals treated when calling Open_Form with the SESSION parameter? Are they session specific?
I am trying to pass information between two forms within different sessions. Would parameters allow me to do this? Is there a way of passing globals between forms in different sessions?
thanks in advance
nSorry but global variables are specific to session and do not span over multiple sessions. U could use parameter forms instead.
-
Open_form in new session and packages
I have form A opened. Form A , calls some stored packages X and set some variable Y in the package.
Now form A calls form B, with session mode. Will the value of variable X.Y be available in form B.
Basically the question is when you open a new form (using open_form , session mode) what happens to the package variable ( stored packages).
Thanking youVariables for stored packages are not visible accross session. Having said that you can try two things, first is as advised by the person earlier.
Secondly, you can write value to a temporary table and read it from there. You can save value in the table using current session id. And when you launch new form with new session pass current id as parameter. New session form can then locate the value from the temporary table.
Best of luck! -
How to read a whole text file into a pl/sql variable?
Hi, I need to read an entire text file--which actually contains an email message extracted from a content management system-- into a variable in a pl/sql package, so I can insert some information from the database and then send the email. I want to read the whole text file in one shot, not just one line at a time. Shoud I use Utl_File.Get_Raw or is there another more appropriate way to do this?
how to read a whole text file into a pl/sql variable?
your_clob_variable := dbms_xslprocessor.read2clob('YOUR_DIRECTORY','YOUR_FILE');
.... -
Using sql:variable in an insert statement
I'm writing an insert statement for a table with an XML column. Most of the XML is static, but I need to replace the value of an element with the value of a T-SQL variable, as shown here:
CREATE TABLE [dbo].[OrderDetail](
[OrderID] [int] NULL,
[OrderDetail] [xml] NULL
GO
DECLARE @XMLData XML;
DECLARE @ItemID INT;
SET @ItemID = 1000;
SELECT @XMLData = N'
<OrderDetail xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
</OrderDetail>
SET @XMLData.modify('insert <ItemID>[sql:variable("@ItemID")]</ItemID> into (/OrderDetail)[1]')
INSERT INTO [dbo].[OrderDetail] ([OrderID], [OrderDetail])
VALUES (@ItemID, @XMLData);
When I run this, it inserts "[sql:variable("@ItemID")]" instead of the value of @ItemID. If someone could show me the proper syntax, I would really appreciate it. Thanks.Yes, that worked. Now I want to change it a little. I also have an attribute that I need to update with the value of a variable.
DECLARE @XMLData XML;
DECLARE @SetID INT;
DECLARE @SetIDStr VARCHAR(12);
DECLARE @SetIDXML XML;
SET @SetID = 9999;
SET @SetIDStr = CONVERT(VARCHAR(12), @SetID);
SET @SetIDXML = CONVERT(XML, @SetIDStr);
SELECT @XMLData = N'
<OrderDetail xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ItemID>1000</ItemID>
<RightOperand ID="15524" Name="ItemName" Value="15524" />
</OrderDetail>
SET @XMLData.modify('replace value of (/OrderDetail/RightOperand/@ID)[1] with sql:variable("@SetIDXML")');
INSERT INTO [dbo].[OrderDetail] ([OrderID], [OrderDetail])
VALUES (@SetID, @XMLData);
SELECT * FROM [dbo].[OrderDetail];
I'm trying to replace "ID="15524"" with the value of @SetID. This code throws an exception:
Msg 9342, Level 16, State 1, Line 23
XQuery [modify()]: An XML instance is only supported as the direct source of an insert using sql:column/sql:variable.
Thanks again for your help. -
Populate the current os directory in a SQL variable
Hello, I need to populate a SQL variable in a script with the current OS directory I am working from. This is a windows environment and I am using oracle version 9.2.0.1. I know if you do SQL>$cd it will execute a cd like you are at the dos prompt. Is there a way to put this into a SQL variable? This is a SQL*Plus script.
Thank you.I have a tech support incident ongoing with ADC about this. People are away for the holidays, but so far I have been able to confirm that PackageMaker itself can't do this, as the name of the current user isn't available, nor do paths to the current Home directory work.
The only way is to have PackageMaker launch a preinstall shell or Applescript that does the "mv <item1> <item2>" or similar (the argument $1 that gets passed to these preinstall scripts IS the name of the user doing the install, so you can get the path to his home directory).
The problem THEN becomes, PackageMaker will not build a package that contains only scripts - it HAS to have some "payload" or you will get a build error. So the ultimate kludge would be to have it run the preinstall script, give it a bogus payload (empty file, etc) to install in e.g., /Library or /Applications, then have the postinstall script delete that bogus payload. I have not tried this so I do not know if it would work.
I am thinking now, with the extremely confusing and apparently contradictory rules that PackageMaker has, that the best way to install software is just to wrap a shell script in an Applescript Application Bundle wrapper (because you can't double-click a shell script without launching Terminal, so to have the user run a shell script you need to wrap it in Automator or AppleScript or a Cocoa app wrapper) and have the shell script do the copying of the files that you need. This still might result in the shell script trying to get some sort of permission (either sudo or that "Override user/group for xxx?" message).
I have read the rules on permissions for Packages about 1,017 times and they still make absolutely no sense to me, and I understand Unix permissions completely. All they would have to do is give some examples, but they don't. -
Sql:variable and XML query performance
Can someone help with sql:variable() in xml queries? It seems that when I attempt to reference variables with the sql:variable(...) function in an xpath function (exist or nodes) it comes up with a totally different query plan, possibly ignoring
my secondary indices like the ones for VALUE, PATH.
But if I replace sql:variable("@p_ObjectIdentifierForReference") with the literal (ie. "ord/p/ord0616.p") then it uses secondary indices more consistently.
Below you will see an unsuccessful attempt to get the query to "OPTIMIZE FOR" a specific literal value of @p_ObjectIdentifierForReference. But this doesn't give work. It doesn't give me a plan using the secondary index I expect.
Ideally there would be a way to get the sql:variable(...) function to give the same query plan as a literal. Not sure why that isn't the default behavior.
DECLARE
@p_ObjectIdentifierForReference
varchar(500);
SET
@p_ObjectIdentifierForReference
= 'ord/p/ord0616.p';
WITH
XMLNAMESPACES ('uri:schemas-progress-com:XREFD:0004'
as D)
SELECT
XREF_FileDataReference.XREF_FileData
AS XrefFileData,
InnerRowNode.value('/D:Reference[1]/D:File-num[1]',
'int')
AS FileNumber,
InnerRowNode.value('/D:Reference[1]/D:Line-num[1]',
'int')
AS LineNumber
FROM
(SELECT
XREF.XREF_FileData.XREF_FileData,
XREF.XREF_FileData.XREF_FileEntry,
InnerRow.query('.')
AS InnerRowNode
FROM
XREF.XREF_FileData
OUTER APPLY
DataXref.nodes('/D:Cross-reference/D:Source/D:Reference[@Object-identifier = sql:variable("@p_ObjectIdentifierForReference")
and @Reference-type = "RUN"]')
as T(InnerRow)
WHERE DataXref.exist('/D:Cross-reference/D:Source/D:Reference[@Object-identifier
= sql:variable("@p_ObjectIdentifierForReference") and @Reference-type = "RUN"]')
= 1)
AS XREF_FileDataReference
INNER
JOIN XREF.XREF_MemberBuilt
ON XREF_MemberBuilt.XREF_FileData
= XREF_FileDataReference.XREF_FileData
INNER
JOIN XREF.XREF_FileEntry
ON XREF_FileEntry.XREF_FileEntry
= XREF_FileDataReference.XREF_FileEntry
WHERE
XREF_MemberBuilt.XREF_ProjectBuilt
= 69
OPTION(RECOMPILE,
OPTIMIZE FOR (@p_ObjectIdentifierForReference
= 'ord/p/ord0616.p')I tried to create a "repro" of your query so we can work on it and try and improve it, but I got the best results by just adding text() and [1] to it, eg
SELECT
XREF_FileDataReference.XREF_FileData AS XrefFileData,
InnerRowNode.value('(/D:Reference/D:File-num/text())[1]', 'int') AS FileNumber,
InnerRowNode.value('(/D:Reference/D:Line-num/text())[1]', 'int') AS LineNumber
FROM (
In my main repro, even with a large piece of xml with 100,000 elements, there still wasn't much difference between the queries:
USE tempdb
GO
IF NOT EXISTS ( SELECT * FROM sys.schemas WHERE name = 'XREF' )
EXEC( 'CREATE SCHEMA XREF' )
GO
IF OBJECT_ID('XREF.XREF_FileData') IS NOT NULL DROP TABLE XREF.XREF_FileData
CREATE TABLE XREF.XREF_FileData
rowId INT IDENTITY,
DataXref XML,
XREF_FileData INT,
XREF_FileEntry INT,
CONSTRAINT PK_XREF_FileData PRIMARY KEY ( rowId )
GO
IF OBJECT_ID('XREF.XREF_MemberBuilt') IS NOT NULL DROP TABLE XREF.XREF_MemberBuilt
CREATE TABLE XREF.XREF_MemberBuilt
XREF_ProjectBuilt INT,
XREF_FileData INT
GO
IF OBJECT_ID('XREF.XREF_FileEntry') IS NOT NULL DROP TABLE XREF.XREF_FileEntry
CREATE TABLE XREF.XREF_FileEntry
XREF_FileEntry INT
GO
-- Create larger piece of xml for repro
;WITH XMLNAMESPACES ( DEFAULT 'uri:schemas-progress-com:XREFD:0004' ), cte AS (
SELECT TOP 100000 ROW_NUMBER() OVER ( ORDER BY ( SELECT 1 ) ) rn
FROM master.sys.columns c1
CROSS JOIN master.sys.columns c2
CROSS JOIN master.sys.columns c3
INSERT INTO XREF.XREF_FileData ( DataXref, XREF_FileData, XREF_FileEntry )
SELECT
SELECT
CASE rn WHEN 9999 THEN 'ord/p/ord0616.p' ELSE CAST( rn AS VARCHAR(20) ) END AS "@Object-identifier",
'RUN' AS "@Reference-type",
SELECT
rn AS "File-num",
rn * 10 AS "Line-num"
FOR XML PATH(''), TYPE
) AS "*"
FROM cte
FOR XML PATH('Reference'), ROOT('Source'), TYPE
).query('<Cross-reference xmlns="uri:schemas-progress-com:XREFD:0004">{.}</Cross-reference>'), 1, 100
INSERT INTO XREF.XREF_FileEntry ( XREF_FileEntry )
VALUES ( 100 )
INSERT INTO XREF.XREF_MemberBuilt ( XREF_ProjectBuilt, XREF_FileData )
VALUES ( 69, 1 )
GO
--SELECT * FROM XREF.XREF_FileData
--SELECT * FROM XREF.XREF_FileEntry
--SELECT * FROM XREF.XREF_MemberBuilt
--GO
-- Add primary XML index
CREATE PRIMARY XML INDEX xidx_XREF_FileData ON XREF.XREF_FileData (DataXref)
GO
-- Add value, property and path xml indexes
CREATE XML INDEX xvalidx_XREF_FileData ON XREF.XREF_FileData (DataXref)
USING XML INDEX xidx_XREF_FileData FOR VALUE
CREATE XML INDEX xpthidx_XREF_FileData ON XREF.XREF_FileData (DataXref)
USING XML INDEX xidx_XREF_FileData FOR PATH
CREATE XML INDEX xprpidx_XREF_FileData ON XREF.XREF_FileData (DataXref)
USING XML INDEX xidx_XREF_FileData FOR PROPERTY
GO
:exit
DBCC DROPCLEANBUFFERS
DBCC FREEPROCCACHE
GO
DECLARE @p_ObjectIdentifierForReference varchar(500);
SET @p_ObjectIdentifierForReference = 'ord/p/ord0616.p';
;WITH XMLNAMESPACES ('uri:schemas-progress-com:XREFD:0004' as D)
SELECT
XREF_FileDataReference.XREF_FileData AS XrefFileData,
InnerRowNode.value('/D:Reference[1]/D:File-num[1]', 'int') AS FileNumber,
InnerRowNode.value('/D:Reference[1]/D:Line-num[1]', 'int') AS LineNumber
FROM (
SELECT
XREF.XREF_FileData.XREF_FileData,
XREF.XREF_FileData.XREF_FileEntry,
InnerRow.query('.') AS InnerRowNode
FROM XREF.XREF_FileData
OUTER APPLY DataXref.nodes('/D:Cross-reference/D:Source/D:Reference[@Object-identifier = sql:variable("@p_ObjectIdentifierForReference") and @Reference-type = "RUN"]') as T(InnerRow)
WHERE DataXref.exist('/D:Cross-reference/D:Source/D:Reference[@Object-identifier = sql:variable("@p_ObjectIdentifierForReference") and @Reference-type = "RUN"]') = 1
) AS XREF_FileDataReference
INNER JOIN XREF.XREF_MemberBuilt ON XREF_MemberBuilt.XREF_FileData = XREF_FileDataReference.XREF_FileData
INNER JOIN XREF.XREF_FileEntry ON XREF_FileEntry.XREF_FileEntry = XREF_FileDataReference.XREF_FileEntry
WHERE XREF_MemberBuilt.XREF_ProjectBuilt = 69
OPTION( RECOMPILE, OPTIMIZE FOR (@p_ObjectIdentifierForReference = 'ord/p/ord0616.p') )
GO
DBCC DROPCLEANBUFFERS
DBCC FREEPROCCACHE
GO
DECLARE @p_ObjectIdentifierForReference varchar(500);
SET @p_ObjectIdentifierForReference = 'ord/p/ord0616.p';
;WITH XMLNAMESPACES ('uri:schemas-progress-com:XREFD:0004' as D)
SELECT
XREF_FileDataReference.XREF_FileData AS XrefFileData,
InnerRowNode.value('(/D:Reference/D:File-num/text())[1]', 'int') AS FileNumber,
InnerRowNode.value('(/D:Reference/D:Line-num/text())[1]', 'int') AS LineNumber
FROM (
SELECT
XREF.XREF_FileData.XREF_FileData,
XREF.XREF_FileData.XREF_FileEntry,
InnerRow.query('.') AS InnerRowNode
FROM XREF.XREF_FileData
OUTER APPLY DataXref.nodes('/D:Cross-reference/D:Source/D:Reference[@Object-identifier = sql:variable("@p_ObjectIdentifierForReference") and @Reference-type = "RUN"]') as T(InnerRow)
WHERE DataXref.exist('/D:Cross-reference/D:Source/D:Reference[@Object-identifier = sql:variable("@p_ObjectIdentifierForReference") and @Reference-type = "RUN"]') = 1
) AS XREF_FileDataReference
INNER JOIN XREF.XREF_MemberBuilt ON XREF_MemberBuilt.XREF_FileData = XREF_FileDataReference.XREF_FileData
INNER JOIN XREF.XREF_FileEntry ON XREF_FileEntry.XREF_FileEntry = XREF_FileDataReference.XREF_FileEntry
WHERE XREF_MemberBuilt.XREF_ProjectBuilt = 69
OPTION( RECOMPILE, OPTIMIZE FOR (@p_ObjectIdentifierForReference = 'ord/p/ord0616.p') )
GO
So I guess I'm saying I cannot reproduce your problem on SQL 2008 R2 or SQL 2012. Does anything about this repro stand out as different from your situation?
Looking at your query I would say you might consider the following:
are you really seeing big differences in query duration?
pretty much ignore estimated plan costs for xml queries
consider breaking it up; eg carve off the xml then do the joins? If poor cardinality estimation is part of the problem this might help
Understand what PATH, PROPERTY and VALUE are for, then only create the ones you need
do you really have the range of queries that requires all three?
this is still a great article on xml indexes:
http://technet.microsoft.com/en-us/library/ms191497.aspx
What's performance like with the primary xml index only?
If performance is that important, consider materialising the columns permanently
I think the buffer_descriptors stuff is a distraction - mostly your cache is warm right?
plan forcing could be a last resort
Selective XML indexes in SQL 2012 onwards are great : ) much less storage required for example but much more specific -
Generic reporting on SQL variables using sqlgls() /Pro*C
Generic reporting on host/SQL variables using sqlgls()
I use sqlgls() in Pro*C 8.1.7 to get the last SQL statement that was parsed.
It returns something like this.
"select distinct QTY ,CHAPTER into :b0:b1,:b2:b3 from PT ,PU ,UIN U ,EU where (PART=:b4 and PU.PART=:b5) ....."
I would like to see what the values are for each input variable e.g :b4 and :b5
Is there any generic way of reporting what these values are rather than explicity writing code for each individual SQL statement?
Is there a Pro*C method that gets the values of :b4 and :b5??
We are recording the last SQL statement to a text file but cannot see what the values are that caused the SQL query to fail.
Please contact me at [email protected]My answer is only for 1. problem (about ORA-01458)
I think that you use declaration for cursor C0 with a varchar
variable before you ininitialize length (member .len of varchar
structure) of this variable.
It's famous that many errors come from uninitialized varchar
variables in Pro*C. -
Load a table in a PL/SQL variable
Hi!
I'm using Oracle 8i and I'm interested in load a table from my database in a PL/SQL variable.In addition,I'm using Nested Table Type for loading a database table in a variable.When I load the table in the variable, I try doing a SQL query to the variable (is a nested table) but it doesn't work.There is some solution?
In the following lines there is an example about what I'm trying:
PACKAGE Types AS
TYPE cursor_type IS REF CURSOR;
END Types;
CREATE TABLE EXAMPLE(
ID NUMBER(4),
VAL Number(3)
CREATE or replace TYPE My_Row_Type AS OBJECT
ID NUMBER(4),
NStreet Number(3)
CREATE OR REPLACE PACKAGE PROVA AS
TYPE My_Tab_Type IS TABLE OF My_Row_Type;
PROCEDURE GetEXAMPLE (p_recordset OUT types.cursor_type);
END PROVA;
CREATE OR REPLACE PACKAGE BODY PROVA AS
PROCEDURE GetEXAMPLE (p_recordset OUT types.cursor_type) AS
v_tab My_Tab_Type := My_Tab_Type();
BEGIN
FOR cur_row IN (SELECT * FROM EXAMPLE) LOOP
v_tab.extend;
v_tab(v_tab.Last) := My_Row_Type(cur_row.ID, cur_row.NStreet);
END LOOP;
-- Open REF CURSOR for outout.
OPEN p_recordset FOR
SELECT *
FROM Table(Cast(v_tab As My_Tab_Type));
END GetEXAMPLE ;
END PROVA;
When I execute the procedure GetEXAMPLE, Oracle shows me the following error:
ERROR en línea 1:
ORA-00600: código de error interno, argumentos: [15419], [severe error during
PL/SQL execution], [], [], [], [], [], []
ORA-06544: PL/SQL: error interno, argumentos: [pfrrun.c:pfrbnd1()], [], [], [],
ORA-06553: PLS-801: error interno [0]Create your My_Tab_Type as a SQL Object Type, instead of a PL/SQL Table Type:
SQL> CREATE TABLE example
2 (id NUMBER (4),
3 nstreet NUMBER (3))
4 /
Table created.
SQL> INSERT INTO example VALUES (1234, 123)
2 /
1 row created.
SQL> INSERT INTO example VALUES (2345, 234)
2 /
1 row created.
SQL> COMMIT
2 /
Commit complete.
SQL> CREATE OR REPLACE TYPE My_Row_Type AS OBJECT
2 (id NUMBER (4),
3 nstreet NUMBER (3));
4 /
Type created.
SQL> CREATE OR REPLACE TYPE My_Tab_Type AS TABLE OF My_Row_Type;
2 /
Type created.
SQL> CREATE OR REPLACE PACKAGE types
2 AS
3 TYPE cursor_type IS REF CURSOR;
4 END types;
5 /
Package created.
SQL> CREATE OR REPLACE PACKAGE prova
2 AS
3 PROCEDURE GetExample
4 (p_recordset OUT types.cursor_type);
5 END prova;
6 /
Package created.
SQL> SHOW ERRORS
No errors.
SQL> CREATE OR REPLACE PACKAGE BODY prova
2 AS
3 PROCEDURE GetExample
4 (p_recordset OUT types.cursor_type)
5 AS
6 v_tab My_Tab_Type := My_Tab_Type();
7 BEGIN
8 FOR cur_row IN (SELECT * FROM example) LOOP
9 v_tab.EXTEND;
10 v_tab(v_tab.LAST) := My_Row_Type(cur_row.id, cur_row.nstreet);
11 END LOOP;
12 -- Open REF CURSOR for output.
13 OPEN p_recordset FOR
14 SELECT *
15 FROM TABLE(CAST(v_tab AS My_Tab_Type));
16 END GetExample;
17 END prova;
18 /
Package body created.
SQL> SHOW ERRORS
No errors.
SQL> VARIABLE g_ref REFCURSOR
SQL> EXEC prova.GetExample (:g_ref)
PL/SQL procedure successfully completed.
SQL> PRINT g_ref
ID NSTREET
1234 123
2345 234
2 rows selected. -
Passing Pl/Sql variables into shell variables.
I have written a file that ftp information from one pc to another in unix.
All you have to do is supply a user_name/password and machine name to which ftp program will connect to.
All connection information like user_id,password, machine name are stored in an oracle table FTP_TBL.
It has the following fields:
FTP_TBL
================
USER_ID NOT NULL VARCHAR2(100);
USR_PASSWD NOT NULL VARCHAR2(50);
TO_MACHINE NOT NULL VARCHAR2(50);
I have called a pl/sql script in unix shell.
This script selects all the connection information from FTP_TBL and populates the pl/sql variables with the
information.
Now i want the pl/sql variables like V_TO_MACHINE,V_USR_ID,V_USR_PASSWD to be passed on to unix variables
To_MACHINE, USR_ID AND USR_PASSWD.
How can i do this?
============================================================================================================
sqlplus -s <<+++ >> $LOG_FILE
$USER/$PASSWD
set serverout on SIZE 1000000
DECLARE
V_TO_MACHINE VARCHAR2(100);
V_USR_ID VARCHAR2(50);
V_USR_PASSWD VARCHAR2(50);
BEGIN
BEGIN
SELECT TO_MACHINE, USER_ID, USR_PASSWD
INTO V_TO_MACHINE,V_USR_ID,V_USR_PASSWD
FROM FTP_TBL;
EXCEPTION
when others then
dbms_output.put_line('ERROR|SQLPLUS|'||ERROR||'|'||sqlcode||'|Failed during selecting configuration information.'||sqlerrm );
END;
END;
+++
#======================== VARIABLES =====================
TO_MACHINE=$1
USR_ID=$2
USR_PASSWD=$3
#========================== MAIN ========================
ftp -vnd $TO_MACHINE << ++ 1>>$STA_LOG_FILE 2>&1
user $USR_ID $USR_PASSWD
prompt off
get $OR_DATA_DIR/ASC.STADATA $HOME_DIR/ASC.STADATA
bye
++
# testing the exit status of FTP
egrep "Transfer complete" $STA_LOG_FILE >/dev/null
if [ $? = 0 ]
then
echo >> $STA_LOG_FILE
echo "FTP Successfully Done" >> $STA_LOG_FILE
else
echo >> $STA_LOG_FILE
echo "FTP UnSuccessfull" >> $STA_LOG_FILE
exit 1
fiHere an example of how to pass variables to the shell script :
TEST@db102 SQL> select ename, job, dname from emp,dept
2 where empno = 7902
3 and emp.deptno = dept.deptno;
ENAME JOB DNAME
FORD ANALYST RESEARCH
TEST@db102 SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[ora102 work db102]$ cat disp_var.sh
set `sqlplus -s test/test << EOF
set pages 0
select ename, job, dname from emp,dept
where empno = 7902
and emp.deptno = dept.deptno;
exit
EOF`
echo $1 $2 $3
[ora102 work db102]$ ./disp_var.sh
FORD ANALYST RESEARCH
[ora102 work db102]$ -
Passing pl/sql variable to Oarcle procedure to java program
Dear
Sir/madam
From java its easy to call procedure or function to get pl/sql variables like cursor type or varray type and cast back to that equi type thro' oracle extn package.Is there any way it could be done vice versa.Can i pass Oarcles Pl/SQL datatype like collection Of type Varray/Custom Object or Cursor,Array type to a procedure or function from java program.Is it possible to pass like that.If so could you kindly give a samll eaxample or URL where same type of example could be found
regards
kingshuDear
Sir/madam
From java its easy to call procedure or function to get pl/sql variables like cursor type or varray type and cast back to that equi type thro' oracle extn package.Is there any way it could be done vice versa.Can i pass Oarcles Pl/SQL datatype like collection Of type Varray/Custom Object or Cursor,Array type to a procedure or function from java program.Is it possible to pass like that.If so could you kindly give a samll eaxample or URL where same type of example could be found
regards
kingshu i suggest to read JPublisher doc - it help support or convert PL/SQL types in Java
http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/java.920/a96658.pdf
Kuassi -
Passing pl/sql variable to oracle procedure from java
Dear
Sir/madam
From java its easy to call procedure or function to get pl/sql variables like cursor type or varray type and cast back to that equi type thro' oracle extn package.Is there any way it could be done vice versa.Can i pass Oarcles Pl/SQL datatype like collection Of type Varray/Custom Object or Cursor,Array type to a procedure or function from java program.Is it possible to pass like that.If so could you kindly give a samll eaxample or URL where same type of example could be found
regards
kingshukDear
Sir/madam
From java its easy to call procedure or function to get pl/sql variables like cursor type or varray type and cast back to that equi type thro' oracle extn package.Is there any way it could be done vice versa.Can i pass Oarcles Pl/SQL datatype like collection Of type Varray/Custom Object or Cursor,Array type to a procedure or function from java program.Is it possible to pass like that.If so could you kindly give a samll eaxample or URL where same type of example could be found
regards
kingshu i suggest to read JPublisher doc - it help support or convert PL/SQL types in Java
http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/java.920/a96658.pdf
Kuassi -
Create a cursor from a PL/SQL variable or an external file
Dear friends,
is there a way for me to make Oracle Forms read a cursor from a PL/SQL variable, or an external file? Let's suppose we have the code below:
DECLARE
cursor c_values is select * from my_table;
r_values c_values%ROWTYPE;
BEGIN
for r_values in c_values loop
do_something;
end loop;
END;
In the situation described above, could I create "select * from my_table" from a PL/SQL variable (it could be something like p_cursor = 'select * from my_table'), or an external file - for example, make my form read the contents of c:\my_select.sql , where we see the "select * from my table" text?
My question comes because I need to export data from select instructions that were dinamically created inside the form - that is, via PL/SQL -, and I don't want to rewrite it, but I'll have to do it if I have no choice. Your help will be greatly appreciated.
Best regards,
Franklin
Edited by: franklinbrasil on 12/03/2009 11:33
Edited by: franklinbrasil on 12/03/2009 11:35Dear friends,
I am using DBMS_SQL package, which solved my problem. Please let me explain it better, if it's not clear.
I have some PL/SQL blocks inside my form, which creates SQL queries dinamically, and a dinamically created SQL is stored into a VARCHAR2 variable. These SQL queries are exported for use in Oracle Graphics, but since OG is not being developed by Oracle anymore then I am trying to find a substitute for it.
So I thought about creating an option for the final user: he/she can choose exporting data into Microsoft Excel, and user does what he/she wants, creating a customized graphic. Exporting into Excel works finely, with no problems at all - I could find a routine by searching on the web.
My goal was to use the same queries created above to export data dinamically to Microsoft Excel, and I absolutely don't want to rewrite all these dinamically created queries - one which works dinamically, other with no flexibility inside my form. Worse than it, I have many other dinamically created queries, and I obviously don't want to rewrite them all - any maintenance in this form would be terrible, with each SQL instruction written twice.
Since all dinamically created SQL instructions are stored inside a VARCHAR2 variable, I thought about reusing the same SQL, as explained above - and here we have your suggestions about using a ref cursor, execute immediate, and so on. And (answering Andreas) query structure is always based on the same table, but its structure changes a lot, depending on what the final user chooses in a drop-down list (it's a list of graphics options, where final user chooses one option, and form must mount SQL dinamically, based on user's choice).
By using your explanations, I could find DBMS_SQL solution here: http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96590/adg09dyn.htm#26799
. Please notice that I had to change DBMS_SQL.native into 1 for it to work in my form. I'll mark all your answers as helpful because I can use them both for database and form purposes.
If my message was not clear enough, please tell me and I'll try to make it more clear.
Best regards,
Franklin -
Hi,
I'm implementing an ASP Javascript page where the items in a
database are returned and sorted based on the results of a
drop-down function. I have it working as follows:
var Recordset1__MMColParam = "Cutting";
if (String(Request("MM_EmptyValue")) != "undefined"
String(Request("MM_EmptyValue")) != "") {
Recordset1__MMColParam = String(Request("MM_EmptyValue"));
%>
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>
if not isempty(request("Select")) then
select case request("Select")
case "Brand"
sql="SELECT * FROM Products WHERE Department = ? ORDER BY
Brand;"
case "High"
sql="SELECT * FROM Products WHERE Department = ? ORDER BY
Our_Price DESC;"
case "Low"
sql="SELECT * FROM Products WHERE Department = ? ORDER BY
Our_Price ASC;"
end select
else
sql="SELECT * FROM Products WHERE Department = ? ORDER BY
special_sort ASC;"
end if
</script>
<%
var Recordset1_cmd = Server.CreateObject ("ADODB.Command");
Recordset1_cmd.ActiveConnection = MM_stark_and_whyte_STRING;
Recordset1_cmd.CommandText = "SELECT * FROM Products;"
Recordset1_cmd.CommandText = sql;
Recordset1_cmd.Prepared = true;
Recordset1_cmd.Parameters.Append(Recordset1_cmd.CreateParameter("param1",
200, 1, 255, Recordset1__MMColParam)); // adVarChar
var Recordset1 = Recordset1_cmd.Execute();
var Recordset1_numRows = 0;
%>
The issue is the line in bold, setting the SQL statement to
be a variable statement where all the parameters are resolved
outside of Dreamweaver, except for the Department, which is defined
by MMColParam. When setting
Recordset1_cmd.CommandText = sql, Dreamweaver no longer
displays the Recordset1 in the Server Behaviour window and all the
server behaviours on the page have a red exclamation mark --
however, the page itself works perfectly (including all server
behaviours). Since I no longer see the Recordset in the server
behaviour window or in the Bindings tab, I can't add new behaviours
or add new bindings to the page (without hand-coding it).
Any ideas?
Neal.MacGyver_971 wrote:
> That's kinda silly. There are many things you cannot do
within the Recordset
> dialog box, and it hasn't changed in years either. Add
to that, I've tried
> (unsuccessfully) to install the updated ADDT for CS4,
which may give me
> additional flexibility, but DW simply crashes when that
extension is installed.
ADDT is not yet compatible with CS4. I've heard others
mention early 2009 was when it would be released, but no news
recently.
> So how are we supposed to create something relatively
simple within
> Dreamweaver like sort a database based on the results of
a drop-down list box
> -- without breaking DW?
It's easy to filter a column value from a form field,
however, Dreamweaver seems to not be able to handle dynamic column
names (which you're doing) or even dynamic sort orders. And I'm
sure there are a number of other things that DW will potentially
choke on. As long as you end up with valid SQL, the generated
recordset can be used, but as you've seen the recordset may not be
available in the Server Behaviors panel, or in the bindings panel.
Here's a suggestion:
1. Copy your recordset opening code block. From your earlier
post:
<%
var Recordset1_cmd = Server.CreateObject ("ADODB.Command");
Recordset1_cmd.ActiveConnection = MM_stark_and_whyte_STRING;
Recordset1_cmd.CommandText = "SELECT * FROM Products;"
Recordset1_cmd.CommandText = sql;
Recordset1_cmd.Prepared = true;
Recordset1_cmd.Parameters.Append(Recordset1_cmd.CreateParameter("param1",
200,
1, 255, Recordset1__MMColParam)); // adVarChar
var Recordset1 = Recordset1_cmd.Execute();
var Recordset1_numRows = 0;
%>
2. Paste that code immediately after the code block you
copied.
3. Delete the line with your sql variable.
4. Then comment out the code by adding /* at the beginning
and */ at the end. Like so:
<%
var Recordset1_cmd = Server.CreateObject ("ADODB.Command");
Recordset1_cmd.ActiveConnection = MM_stark_and_whyte_STRING;
Recordset1_cmd.CommandText = "SELECT * FROM Products;"
Recordset1_cmd.Prepared = true;
Recordset1_cmd.Parameters.Append(Recordset1_cmd.CreateParameter("param1",
200,
1, 255, Recordset1__MMColParam)); // adVarChar
var Recordset1 = Recordset1_cmd.Execute();
var Recordset1_numRows = 0;
%>
That should allow you to have DW recognize the recordset from
the commented out code block and not the one that you're generating
dynamically.
In a quick test locally, that seemed to work fine for ASP
JavaScript. For others listening in, ASP VBScript may not work out
so well as it doesn't allow for multi-line comments (that I'm aware
of), and you may run into issues with re-dimmed variables, so play
around with commenting out some lines and maybe you'll find a combo
that works.
Danilo Celic
|
http://blog.extensioneering.com/
| WebAssist Extensioneer
| Adobe Community Expert -
Hi Gurus, I was unable to see where I can define local and global variables? I see that help.sap.com documentation but where do I create. All variables that I create, are global because, they are visible to all and they all can use it? Any help would be greatly appreciated.
As far as I know, Variables are re-usable objects that are not dependent upon InfoProvider. When I look at this link
http://help.sap.com/saphelp_nw04/helpdata/en/5c/8db07d555411d189660000e829fbbd/frameset.htm
it talks about Global and Local variable? Is this different than what we use in Query Designer?
Maybe you are looking for
-
Compability problem with Java and Python RSA algorithm implementation
I have client server application. Server is writtein in python, client in java. Client receives messages from server encrypted with RSA (http://stuvel.eu/rsa), and I'm unable to decrypt it. It seems that this is RSA algorithm compatibility problem. I
-
Bold chars & increase font size in ALV Top of Page - OOPS
Hi, I am using ALV OOPs to display my data. I am splitting the container and using top container to display headings in following way: data: top TYPE REF TO cl_dd_document CREATE OBJECT top EXPORTING style = 'ALV_GRID'. lv_fontsize =
-
Why the ISTORE of Malta is not up to date with the latest movies and series like the UK & USA and why old movies are being uploaded . I believe the apple should be universal in all the products and a small island like Malts should have the same produ
-
Getting Problem in Migration 8.1 WLAS to 9.2.1!!
Solved Edited by mittalsaurabh24 at 03/16/2008 9:02 PM
-
Hooking up mail client with Gmail
I have a feeling that something is amiss in the way my machine is configured, but I've become frustrated because I can't find instructions to setup Apple Mail 1.3.11 (only Mail 3 is illustrated at the Google site). There are a lot of generalities giv