Return a outparam value into a UNIX variable
Hi all
I have requirement wherein, i need to set the value of oracle stored procedure outparam into a unix variable,
How can it be acheived?
Thanks in advance
Regards
Deepak
You can use the exit command of SQL*Plusm but this is restricted to numbers between 0 and 255:
cat test.shecho "variable result number
exec :result := 42
exit :result" | sqlplus scott/tiger@oracle
export UNIX_RESULT="$?"
echo The unix result value is $UNIX_RESULT
:/home/scott
./test.sh
SQL*Plus: Release 9.2.0.8.0 - Production on Mi Okt 14 09:48:39 2009
The unix result value is 42Hth, Urs
Similar Messages
-
Reading Timestamp value into an SSIS variable
I need to read the last timestamp value (MAX(TimeStampValue)) from a table, store it in a variable in SSIS and using the variable, perform a comparison against another table and load delta records.
The string data type is not playing well with the timestamp data type and things get even more complicated if I try to store the timestamp value as a varchar in a table.
Is there any variable data types in SSIS that will store the timestamp value easier than a string?It could be due to the time stamp value being incompatible with the date time functions which you need to fix.
So to make it conform manipulate on its value to get the proper format.
PS: Varchar WILL swallow any text, please be more specific, think how others would be reproducing YOUR issue.
Arthur My Blog -
Return all the values into cursor
I want to return collection of varray using sys_refcursor. but it is returning only last record. I am wondering how I can return all the four records into result sys_refcursor.
The following is not returning all the four records under SP.
resultData OUT sys_refcursor
for i in 1..4
loop
OPEN result FOR
Select sdo_util.to_wkbgeometry
(sdo_geometry(2002, 2958, Null,
Mdsys.Sdo_Elem_Info_Array(1,2,1),
arr_result123(i)
)) as geometry
FROM dual c;
end loop;
Thanks
AlI have removed the for loop but no luck. I am posting my whole procedure.
Can you please let me know what i am missing!..........urgent please.
PROCEDURE SP_Lines
mlatlon IN Varchar2,
resultData OUT sys_refcursor
) As
plat Varchar2(256);
plon Varchar2(256);
lPosition number;
lcounter number;
newlat number;
newlon number;
-- to draw lines
geometry1 mdsys.sdo_geometry;
geometry2 mdsys.sdo_geometry;
begin
Begin
arr_result123 := arr_result(
mdsys.sdo_ordinate_array(-79.7198833241796,43.7437243394591,-79.7170360355377,43.7503404513126),
mdsys.sdo_ordinate_array(-79.618833241796,43.5437243394591,-79.7170360355377,43.7503404513126),
mdsys.sdo_ordinate_array(-79.4198833241796,43.3437243394591,-79.7170360355377,43.7503404513126),
mdsys.sdo_ordinate_array(-79.1198833241796,43.1437243394591,-79.7170360355377,43.7503404513126),
mdsys.sdo_ordinate_array(-79.0198833241796,43.0437243394591,-79.7170360355377,43.7503404513126),
mdsys.sdo_ordinate_array(-79.7198833241796,43.007243394591,-79.7170360355377,43.7503404513126),
mdsys.sdo_ordinate_array(-79.7198833241796,43.7437243394591,-79.7170360355377,43.7503404513126),
mdsys.sdo_ordinate_array(-79.7198833241796,43.7437243394591,-79.7170360355377,43.7503404513126) );
lPosition := Instr(mlatlon, '_');
plat := Substr(mlatlon, 1, lPosition-1);
plon := Substr(mlatlon, lPosition+1, length(mlatlon) );
lcounter :=1;
--get 4 nearest points
for rec in (
Select sdo_cs.transform(c.geometry,4326) as geometry
FROM Ac c
where SDO_NN(c.GEOMETRY,
(sdo_geometry(2001, 4326, sdo_point_type(plon, plat, null), null, null) )
, 'sdo_batch_size =5')='TRUE'
AND ROWNUM <= 4
loop
newlat := get_ordinate(rec.geometry, 2);
newlon := get_ordinate(rec.geometry, 1);
-- ~~ building geometries ~~
geometry1 := sdo_geometry(2002, 4326, sdo_point_type(newlon, newlat, null), null, null);
geometry2 := sdo_geometry(2002, 4326, sdo_point_type(plon, plat, null), null, null);
arr_result123(lcounter) := GET_LINE_ORDINATE(geometry1, geometry2);
lcounter:=lcounter+1;
end loop;
end if;
lcounter:=1;
OPEN resultData FOR
Select sdo_util.to_wkbgeometry
(sdo_geometry(2002, 2958, Null,
Mdsys.Sdo_Elem_Info_Array(1,2,1),
arr_result123(lcounter)
)) as geometry
FROM dual c, (select level lcounter from dual connect by level <=2);
END;
end SP_Lines; -
How to execute a function and return the result into a bind variable
Hi,
I am trying to calculate the sum of salaries of all persons with a particular JOB_ID using a function TOTAL_INCOME(v_job_id).
create or replace function total_income
+(v_job_id IN varchar2)+
RETURN number IS
v_total number(6);
cursor get_sal is
select salary from employees
where job_id = v_job_id;
BEGIN
v_total := 0;
for emp in get_sal
loop
v_total := v_total emp.salary;+
end loop;
dbms_output.put_line('Total salary of '||v_job_id||' is: '|| v_total);
return v_total;
END;
Now I woud like to execute this function and assign the returned value into a bind variable test_sal
variable test_sal number(6)
SELECT total_income('AD_VP') into :test_sal FROM DUAL;
dbms_output.put_line('Total Sal:'||:test_sal);
This is returning the below errors:
SELECT total_income('AD_VP') into :test_sal FROM DUAL
*+
Error at line 0
ORA-01036: illegal variable name/number
dbms_output.put_line('Total Sal:'||:test_sal);
Error at line 3
ORA-00900: invalid SQL statement
Could someone help me what could be the problem?? Thanks for your time...Dear,
If everything you will do will be done inside PL/SQL (stored procedure or stored function) then you don't have to care about bind variable.
When using PL/SQL (static SQL) you will never encounter issues related to bind variables. PL/SQL itself takes care of your code and uses bind variables behind the scene.
The only situation where you have to look carefully to the use of bind variables within PL/SQL is when you use Dynamic sql into stored procedures or functions.
So, see in the light of the above comment, if you have to care about returning your function into a bind variable?
Best regards
Mohamed Houri -
How to read the input field value into ABAP variable?
Hi All,
i need a read the value of an input field into an ABAP variable,and i am doing this in the following way
lstring = request->get_form_field('myFlag').
here 'myFlag' is the input field name,but this is not returning me any value into lstring.
I have gone through the SDN and tried to do this.
could you please help me out to resolve this issue.
Thanks in Advance,
PraveenaDear Praveena
In which event are you putting this code. Place it in oninputprocessing event(Page with flow logic Model of coding). Then it will surely work.
Regards
Vijay.M -
Passing unix variable value to plsql block
hi..
i want to pass the value of a unix variable to a pl/sql block. I dont know how to go about it.
My code is
for all the files in the directory, ( say $i as the file name )
sqlplus -s <<!
cmdp_rdev/cmdp_rdev@cmdp
declare
no number:= 0;
BEGIN
no := run_owb_mapping('CMDP_RDEV','LOC_PROC_FLOW','PROCESS','PROCESS_HOTEL_DATA',CUSTOM_PARAMS='FILE_NAME=$i');
end;
In the above example, i want the file name ( if x.txt ) to be passed to the procedure call as :
no := run_owb_mapping('CMDP_RDEV','LOC_PROC_FLOW','PROCESS','PROCESS_HOTEL_DATA',CUSTOM_PARAMS='FILE_NAME=x.txt');
How do i do this..
thanx in advancethank you for the reply..
well that will not work.. since values concatenated to strings cannot be passed as parameters.
for the file Oct_2005.csv, the following was the output
no := run_owb_mapping('CMDP_RDEV','LOC_PROC_FLOW','PROCESS','PROCESS_HOTEL_DATA'
,p_custom_params=>'FILE_NAME='''||Oct_2005.csv||'');
ERROR at line 4:
ORA-06550: line 4, column 115:
PLS-00201: identifier 'OCT_2005.CSV' must be declared
ORA-06550: line 4, column 1:
PL/SQL: Statement ignored
------------------------------ -
Saving the output of JSTL into a java variable
Hi All, Apologies if this has been asked before, but i've been looking for an answer to this question for 2 hours and can't find anything..
I have a simple JSP page which queries a database. The database will only return one value, which is printed out perfectly with:
<c:forEach var="row" items="${qryPosts.rows}">
<c:set var="email" value="${row.email}" />
<c:out value="${row.email}" />
</c:forEach>
First question: Do i have to go through all this if I know there will only ever be one value returned from my SQL statement?
Second question: How can I get the returned value into a JSP variable, so I can use it in my java code.
Thanks very much to anyone who can help,
Regards,
BrettFirst a couple of disclaimers. If you've been looking through this forum, you've probably come across these pointers before.
- don't use SQL in a JSP page. It should be in a Servlet/Bean.
- don't mix JSTL and scriptlet code within a JSP. It makes the page even worse than scriptlet alone.
Those are just recommendations based on my experience, and best practice.
Having said that, here are the answers to your questions
1 - No, you don't need to have a forEach loop
If you know that there will be one and only one result returned, you can get at it via the expression
${qryPosts.rows[0].email}
With regards to getting it out to java code
<c:set var="email" value="${qryPosts.rows[0].email}"/>
and then you can use this:
<jsp:useBean id="email" type="java.lang.String"/>
or scriptlet code like this:
<%
String email = pageContext.findAttribute("email");
%>
Cheers,
evnafets -
Passing struts-tag value to java / javascript variable in JSP
Hello all,
Im trying to pass the value got from the struts-tag to the java variable in the Jsp. However Im not able to get the o/p. Can u guys help me on this pls...
<logic:notEmpty name="TreeBean" property="list">
<logic:iterate id="Type" name="TreeBean" property="list" indexId="i">
<br/><bean:write name="Type" />
</logic:iterate>
</logic:notEmpty>Here the list can be populated in the jsp page. However i want the values into jsp list. Im not able to populate the same..
<% List jspList = null;
%> I want the values into the jspList variable for further processing. Can u guz pls help me on this....Which do you want it in?
A java variable for use in <% scriptlet code %> or a javascript variable for use on the client end?
scriptlet:
<jsp:useBean id="TreeBean" type="java.util.List" class="java.util.ArrayList" scope="?????" />
Having scriptlet code on the page is considered bad coding style.
What is it you are trying to accomplish by making the value accessible?
What are you trying to do in java / javascript that can't be done with JSP tags? -
The Popup dialog Page needs two times to return the selected value[10.1.3]
Hi All,
I have problem in an JSF Application that uses the EMP and DEPT tables .
the Application contains two pages
page 1 : a calling page uses EmpView as ADF Table .
page 2 : a popup List of Values (LOV) dialog page uses DeptView
These cause the popup dialog page to return to the calling page and to set the selected value into the Deptno attribute .
the calling page includes :deptno and dname columns as
<af:column headerText="#{bindings.EmpView1.labels.Deptno}">
<af:selectInputText value="#{row.Deptno}"
required="#{bindings.EmpView1.attrDefs.Deptno.mandatory}"
columns="#{bindings.EmpView1.attrHints.Deptno.displayWidth}"
action="dialog:ChooseDept1" id="deptnoField"
autoSubmit="true">
<f:convertNumber groupingUsed="false"
pattern="#{bindings.EmpView1.formats.Deptno}"/>
</af:selectInputText>
</af:column>
<af:column headerText="#{bindings.EmpView1.labels.Dname}">
<af:inputText value="#{row.Dname}" simple="true"
required="#{bindings.EmpView1.attrDefs.Dname.mandatory}"
columns="#{bindings.EmpView1.attrHints.Dname.displayWidth}"
partialTriggers="deptnoField" autoSubmit="true"/>
</af:column>
and popup dialog page includes : Submit Button to return selected value to calling page :-
<af:tableSelectOne text="Select and">
<af:commandButton text="Submit">
<af:returnActionListener value="#{row.Deptno}"/>
<af:setActionListener from="#{row.Deptno}"
to="#{bindings.Deptno.inputValue}"/>
</af:commandButton>
</af:tableSelectOne>
the problem is
I have to press ( two times ) the select button in the calling page to
return the selected value into the Dname attribute .
best regards,Hi,
However, I am using the Jdeveloper 10.1.3.3, but still getting this error. I could not find any threads related to this problem and hence I wrote up here. Anyway I have also logged an SR #7179012.993 for the same with the testcase. I hope the issue will be resolved soon.
Thanks,
Neeraj -
Without using applets geting the output into a javascript variable
Hi,
I'm not using executeCommand applets in my webpage,but with the url
i'm running the transaction. I'm passing the url to iframe as a <b>src</b> in the same page itself. like
<b>document.getElementById("<iframe>").src="http://localhost/Lighthammer/Runner?Transaction=<Transaction_Name>&<Input_params>=<value>&OutputParameter=*"</b>. It will take 10 seconds to execute the transaction and load into the iframe.
So I'm giving the
<b>SetTimeout("alert(document.getElementById('<iframe>').docuemnt.body.innerHTML",10000);</b>
In the iframe i'm able to see the output as "<u>oktransaction executed</u>" in <u>xml format</u>.
But in the alert I'm not able to see the same content. <i>In the alert I'm able to see</i>
<u><iframe id="<id of iframe>" src="<Which i set in the script>"></iframe></u>
Help me to get the OutputParameter value into a javascript variable.Rakesh,
A couple of observations:
1. Why are you calling Runner directly? You should be using an XacuteQuery template, and reference "/Lighthammer/Illuminator?QueryTemplate=Folder/TRX" syntax when changing the URL in the iFrame.
2. You are also using "localhost" which is not portable and may also be causing your problem since your parent page will be based upon the server path, whereas you are forcing the browser to load localhost content into the iFrame (which unless you are physically sitting on the xMII server itself will never work).
Regards,
Jeremy Good -
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 -
Fetches more values into one variable
Hi, inside a cursor loop I'd like to assign, each fetch, a value to a variable, in order, at the end to have a collection of all the values fetched into the same variable.
The code is the following:
CREATE OR REPLACE procedure APPS.AAA as
v_pino varchar2(64);
CURSOR tks_opened_range IS
SELECT incident_number AS YP_TKS_OPENED_WITHIN_RANGE FROM cs.cs_incidents_all_b a, cs_incident_statuses_b b, Cs_Incident_Statuses_Tl c
WHERE b.incident_status_id = c.incident_status_id
AND a.incident_status_id = b.incident_status_id
AND (b.attribute1 <> '3' OR b.attribute1 IS NULL)
AND c.language = 'EL'
AND ((sysdate - to_date(incident_attribute_6, 'dd-mm-yyyy hh24:mi'))*1440) BETWEEN 1 AND 11111111111
AND incident_attribute_2 IN ('ΓΕΝΙΚΗ ΔΙΕΥΘΥΝΣΗ ΤΕΧΝΟΛΟΓΙΑΣ')
ORDER BY incident_number;
rec_tks_opened_range tks_opened_range%ROWTYPE;
begin
FOR rec_tks_opened_range IN tks_opened_range
LOOP
v_pino := rec_tks_opened_range.YP_TKS_OPENED_WITHIN_RANGE;
DBMS_OUTPUT.PUT_LINE('v_pino: ' || v_pino);
end loop;
end AAA;
This works with the variable v_pino!....but at the end, the value of the variable v_pino is ONLY the last fetched by the cursor.
Is there a way to declare a variable (or better a collection) or a new type in order to have all the data fetched into this variable and the end of the fetching ?
I need to know this trick because, after, I have to assign this variable to a pipelined table function.
Thanks in advance
Alex
/Great Devang !! Thanks a lot ! It works ! Now I am able to retrieve all the values I need and store them into my variable gino
I searched on the note you mentioned in your mail in order to pass an array as a variable to a table function (PIPE ROW call), but I didn't find nothing about it.
Now I explain to you my situation.
I already implemented a table function that works perfectly. I have 2 cursors declared and 2 PIPE ROW calls.
FUNCTION statistic_report_2_1 (p_resolv_time_ll varchar2, p_resolv_time_ul varchar2, p_ypiresia varchar2)
RETURN xxi_statistic_rep_2_1_tab PIPELINED
IS
-- CURSORS FOR THE FIRST SHEET - Tickets opened per group and per duration
-- Cursor for tickets opened within 1 hour --
CURSOR tks_opened_1_h IS
SELECT incident_number AS YP_TKS_OPENED_WITHIN_1_HOUR
FROM cs.cs_incidents_all_b a, cs_incident_statuses_b b, Cs_Incident_Statuses_Tl c
WHERE b.incident_status_id = c.incident_status_id
AND a.incident_status_id = b.incident_status_id
AND (b.attribute1 <> '3' OR b.attribute1 IS NULL)
AND c.language = 'EL'
AND ((sysdate - to_date(incident_attribute_6, 'dd-mm-yyyy hh24:mi'))*1440) < 60
AND incident_attribute_2 IN (SELECT * FROM TABLE(CAST(xxi_szf_discoverer.ypiresia_values(p_ypiresia) AS xxi_ypiresia_list_tab)))
ORDER BY incident_number;
rec_tks_opened_1_h tks_opened_1_h%ROWTYPE;
-- Cursor for tickets opened between 1 hour and 3 hours --
CURSOR tks_opened_1_3_h IS
SELECT incident_number AS YP_TKS_OPENED_BE_1_3_HOURS FROM cs.cs_incidents_all_b a, cs_incident_statuses_b b, Cs_Incident_Statuses_Tl c
WHERE b.incident_status_id = c.incident_status_id
AND a.incident_status_id = b.incident_status_id
AND (b.attribute1 <> '3' OR b.attribute1 IS NULL)
AND c.language = 'EL'
AND ((sysdate - to_date(incident_attribute_6, 'dd-mm-yyyy hh24:mi'))*1440) BETWEEN 60 AND 179
AND incident_attribute_2 IN (SELECT * FROM TABLE(CAST(xxi_szf_discoverer.ypiresia_values(p_ypiresia) AS xxi_ypiresia_list_tab)))
ORDER BY incident_number;
rec_tks_opened_1_3_h tks_opened_1_3_h%ROWTYPE;
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
-- FIRST SHEET OPEN CURSORS --
TICKETS NUMBER OPENED WITHIN 1 HOUR
FOR rec_tks_opened_1_h IN tks_opened_1_h
LOOP
PIPE ROW(stat_rep_2_1_type(
rec_tks_opened_1_h.YP_TKS_OPENED_WITHIN_1_HOUR
END LOOP;
-- TICKETS NUMBER OPENED BETWEEN 1 HOUR AND 3 HOURS --
FOR rec_tks_opened_1_3_h IN tks_opened_1_3_h
LOOP
PIPE ROW(stat_rep_2_1_type(
,rec_tks_opened_1_3_h.YP_TKS_OPENED_BE_1_3_HOURS));
END LOOP;
RETURN;
END statistic_report_2_1;
But, in this way and with this syntax, I obtain for each PIPE ROW call only one field filled each time, because I can’t call 2 cursors in a nested loop together (data duplication);
For example:
1st PIPE ROW call : only the first field is filled and into the second I have to put ‘’
2nd PIPE ROW call : only the second field is filled and into the first I have to put ‘’
….and I cant’ call with a single PIPE ROW call two cursor variables…..
Into a Discoverer report this data layout is really bad (you can imagine with thousand
of records).
For this reason I thought to use an array variable (gino) to pass to a single PIPE ROW call outside the cursor loop……but it doesn’t work !!!
Can you suggest me how to resolve this problem….if it possible ?
Did I have to declare other TYPE or collection ?
Thanks you so much
Alex -
Hi everybody,
I need to use F4IF_INT_TABLE_VALUE_REQUEST FM because I have to let users select an specific option before choosing another value. The point is that I need to save in a program global variable what the user selects, and decide something with it in the program.
Is it possible that F4IF_INT_TABLE_VALUE_REQUEST FM returns the value in a sinple variable or it has to be paramter?
I look in a lot of previous threads but I didn't find anything, and I don't know if it's possible.
Thanks and kind regards,
MMP.Hi,
Sure you can. All you need to do is to store what the function returns in your global variable. It don't need to be returned back to screen field.
DATA: BEGIN OF VALUES OCCURS 0,
CARRID TYPE SPFLI-CARRID,
CONNID TYPE SPFLI-CONNID,
END OF VALUES.
DATA: VALUES_TAB TYPE TABLE OF VALUES,
G_VALUE TYPE SPFLI-CONNID. "global variable to store what is returned
"in PAI first populate your table
SELECT CARRID CONNID
FROM SPFLI
INTO CORRESPONDING FIELDS OF TABLE VALUES_TAB
UP TO 10 ROWS.
"then call the function but don't return the value to screen field
"If you specify the import parameters DYNPPROG, DYNPNR, and DYNPROFIELD, the useru2019s selection is
"returned to the corresponding field on the screen. If you specify the table parameter RETURN_TAB, the
"selection is returned into the table instead.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'CONNID'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = VALUES_TAB
RETURN_TAB = RETURN_TAB.
"now simply read first row of return tab and store the value returned there in some global var
READ RETURN_TAB INDEX 1.
MOVE RETURN_TAB-FIELDVAL TO G_VALUE.
Regards
Marcin -
Passing Unix variable into sql
Hi,
I have a shell script with embedded SQL.
In the script I have a Unix variable that has a char value
id="P_test".
I need to pass this variable to a select in a where condition like
select * from table where camp1=$id.
The problem is $id returns P_test rather than 'P_test' so that the select can work.
Any ideea how to change the clause where to make the select work?
I could also change the variable id as to have id=" 'P_test' " , but this variable comes from a file parsed and I don't know how to get 'P_test' instead of P_test.
Thanksanother option may be like this example -
$OH10/bin/sqlplus -s > $CIGDEM_LOG_DIR/step1_$CIGDEM_DATE.log 2> $CIGDEM_LOG_DIR/step1_$CIGDEM_DATE.err <<EOF
$CIGDEM_USERNAME1/$CIGDEM_PASSWORD1@$OTNS10
@$CIGDEM_DIR/step1.sql $CIGDEM_EXP_DIR $CIGDEM_USERNAME3 $CIGDEM_PASSWORD3 $PERMANANT_TABLESPACE $TEMPORARY_TABLESPACE
exit ;
EOF
"@$CIGDEM_DIR/step1.sql $CIGDEM_EXP_DIR $CIGDEM_USERNAME3 $CIGDEM_PASSWORD3 $PERMANANT_TABLESPACE $TEMPORARY_TABLESPACE" here we call step1.sql with arguments, they will be used with &n symbol inside sql statement -
.. CREATE USER &2 IDENTIFIED by &3 TEMPORARY TABLESPACE &5 DEFAULT TABLESPACE &4 ; ..http://tonguc.wordpress.com/2007/11/29/linux-and-shell-scripting-part-2/ -
Return Into. Can I return the old value in an update statement?
Hello - I have an update statement and I need the value of a field, prior to the update. Is it possible to use the Return Into to do this? Or do I have to have a separate select statement prior to the update statement in order to store that value in a variable?
Thanks!RETURNING INTO is valid for an UPDATE, but it returns the new value, not the old value.
SCOTT @ nx102 Local> select * from a;
COL1
4
Elapsed: 00:00:00.00
SCOTT @ nx102 Local> ed
Wrote file afiedt.buf
1 declare
2 l_old_col1 number;
3 begin
4 update a
5 set col1=col1+1
6 returning col1 into l_old_col1;
7 dbms_output.put_line( l_old_col1 );
8* end;
SCOTT @ nx102 Local> /
5
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00If you are trying to track historical changes, have you looked at Workspace Manager? That can be far easier than writing your own change tracking code...
Justin
Maybe you are looking for
-
GRC 10.0 - Transport Connector Relevant Settings
Hi Gurus, Many of you have already completetd GRC 10.0 implementaion. One of the Key advantage of GRC 10.0 stated as "Changes can be transported". While carrying out configuration settings under nodes SPRO -->GRC --> Common Component Settings --> Int
-
Laptop only coming up with a blank screen after set-up?
Ok, so. My parents bought me a brand new hp laptop for christmas. On christmas day i went through the whole set-up process and did all the steps it told me to do. When i'd been through all the steps, i got a loading symbol and ever since, all it come
-
Problem in passing parameters between flow task in a dynamic region
Hi, I have a problem with the passing of parameters between task flow when it is executed within a dynamic region. To implement this, I followed the Baranovskis Andrejus Blog "JDeveloper 11g and ADF Task Flow Parameters" and everything works perfect
-
Non-US keyboard layout in Xorg
Hello, I have a Belgian keyboard layout and had some troubles with the Alt-Gr key. We combine this key with other keys to generate special symbols like the Euro sign or the @ character for example. I found several solutions on several websites but th
-
Hi all I have a kerberos client that uses Krb5LoginModule to authenticate to a KDC and obtain a TGT. Is there a way to store, programatically, the obtained TGT into a local file cache (as krb5_ccUsername)? regards