How to get the return value in sqlplus to index?
HelloI am a PL/SQL Developer, and I have a problem with an existing batch.
Here's the situation:
I have a lot of unix, calling a first script sql with sqlplus (call script0.sql )
script0. SQL call other scripts sql with the command @ (script1.sql, script2.sql,... = > scriptx.sql )
My version of sqlplus is 9.2.
ScriptX.SQL modifies the data in table with insert or update and not commit or rollback anything (it is in charge of script0.sql ).
If there is an error produced in a clue all changes must be rollbacked.
Unfortunately when something fails, it returns only to script0.sql without any information on his breaks down, so continuous script0.sql and when he arrivals all changes are committed because the State of script0.sql is successful when the exit is made.
Is there an equivalent of the $? UNIX in sqlplus to obtain the return of a status @scriptx.sql?
-----
Here is the general syntax of the script0.sql :
WHENEVER SQLERROR EXIT 99;
WHENEVER OSERROR EXIT 98;
@script1.sql
@script2.sql
"exit";
-----
Here's a simple scriptx.sql file:
Insert into table values (x) (y);
-----
Published by: user10713865 on October 30, 2009 06:51
Hello
You can use 'Whenever SQLERROR WHAT' options to build the logic.
Use: 'every time THAT SQLERROR EXIT DISMANTLING', if you want to there are a whole script error
OR "WHEN SQLERROR CONTINUE ROLLBACK", if you want to restore and continue to the next.
You might explore other options 'whenever SQLERROR WHAT' to suit your logic and add "COMMIT / ROLLBACK" to not relevant.
See sample tests below:
SQL> create table t1 (col1 number primary key);
Table created.
* 1. In script1 case fails, then restore and exit *.
kallo:f632736> cat 1.sql
WHENEVER SQLERROR EXIT ROLLBACK
insert into t1 values(1);
insert into t1 values(1);
kallo:f632736> cat 2.sql
insert into t1 values(2);
kallo:f632736> cat main.sql
@1
@2
SQL> @main
1 row created.
insert into t1 values(1)
*
ERROR at line 1:
ORA-00001: unique constraint (ADMLHMGM.SYS_C0013874) violated
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select * from t1;
no rows selected
* 2. When script1 fails, then restore and continue to script2 *.
kallo:f632736> cat 1.sql
WHENEVER SQLERROR CONTINUE ROLLBACK
insert into t1 values(1);
insert into t1 values(1);
SQL> @main
1 row created.
insert into t1 values(1)
*
ERROR at line 1:
ORA-00001: unique constraint (ADMLHMGM.SYS_C0013874) violated
Rollback complete.
1 row created.
SQL> select * from t1;
COL1
----------
2
Tags: Database
Similar Questions
-
How to get the return value from Java runtime.getRuntime.exec?
I am running shell from a (GR 11, 2) Oracle database commands on aix.
But, I would get a return value of a shell comand... as you get with "echo $?"
I use a code like
but I do not get a return value... because I don't know how to get the return value...CREATE OR REPLACE JAVA SOURCE NAMED common."Host" AS import java.io.*; public class Host { public static int executeCommand(String command) { int retval=0; try { String[] finalCommand; finalCommand = new String[3]; finalCommand[0] = "/bin/sh"; finalCommand[1] = "-c"; finalCommand[2] = command; final Process pr = Runtime.getRuntime().exec(finalCommand); pr.waitFor(); } catch (Exception ex) { System.out.println(ex.getLocalizedMessage()); retval=-1; } return retval; }; /
Published by: user9158455 on 22-Sep-2010 07:33Hello
Your pr.exitValue () has tried?
I think you also need a finally block that destroys the sub-process
Concerning
Peter -
Hi all
I'm calling javascript from COM (c#) and it works fine. Passing parameters to javascript and playback by using the syntax of the [x] arguments also works very well.
What I can't seem to get to work is to know how to move something from javascript to the calling COM Summoner, in this case, c#. How and where should I place the return value in javascript?
Thanks in advance.
Rachiud
doScript() evaluates an expression, so just make sure that your Javascript is an expression.
For instance "(3 + 3)" 6 "
-
How to get the return value of the method by calling the stored procedure in ApplModuleImpl
Hello
I use Jdev 10.1.3.4
JSF, and ADF business components
I created a service method in the implementing class of module request to execute the strored procedure in the database.
This breeding returns a string value.
now, I slipped the method of service of data control palette on my JSF page and chose ADF parameter form when I droped.
It works very well.
now, I want to display the string returned by the method of service after the execution on the JSF page as global messages.
How can I achieve this.
Help, please
Thanks in advance
Kind regards
Ajit AgarwalHello
You must run programmatically run the method binding. If I'm not wrong then the following code will allow you to access the return value
OperationBinding oper = bindings.get("MyPLSQLAccessMethodBinding") (OperationBinding);
String returnValue = oper.execute ((String));Once you have the string in a managed bean you can add it to the stack of messages JSF exposed by the FacesContext
Frank
-
How to get the return value of the activity of the method in the stubborn workflow
Hi all
I use Jdeveloper 11 g R2 (11.1.2.3) & Weblogic 10.3.5.0
I have a stubborn workflow, default activity is a call method than calling a method in the app module
This method returns an id
I need this code in my project to do something else
Is there a way I can access the return value of the method call activity?
Concerning
MohsenSet the value of return as #{{pageFlowScope.myBean.returnValue} pageFlowScope.myBean.returnValue} in the method, call the property inspector and get the value in your managed bean.
String returnParam = (String) JSFUtil.getFromPageFlow ("returnValue");
-
How to get the return value of INSERT... RETURN clause?
Hello
With the help of the WEST, how I'm supposed to retrieve the value returned by queries like:
INSERT INTO... VALUES (...) RETURN xxx IN: res
?
Thank you
KirilIt works for me. Someone posted the code for him on this thread:
BLOB vs BFILEI tested successfully an integer column and also return the rowid of INSERTION. Note that the call to registerOutParam is necessary - without that I just became a string vacuum back to rowid.
I tested with 11.2 customer against 10.2 server.
-
How to get the return values by a button on the main program.
Hello
I have a main program that has an Authenticate button. Click to authenticate open for auth form that has the USERNAME and PASSWORD FIELDS.
If the input fields are true then enable editing of jtable in main program...
Basically something like this:
main program
Authenticate.addActionListener (new ActionListener()
{
public void actionPerformed (ActionEvent ae)
{
Au UpdateAuth = new UpdateAuth(); / / Opens the form that has the username and pass for authentication
ua.setVisible (true);
need code for activation of table here
if(s=="mactus")
{
enable editing of the table
}
table.repaint ();
}
});
form opened for auth... (class UpdateAuth)
private String SigninMouseClicked (java.awt.event.MouseEvent evt) {}
String aname = Aname.getText ();
String apass = Apassword.getText ();
If (aname. Equals("") & & apass.equals(""))
{
JOptionPane.showMessageDialog (null, "enter the login name or password", "Error", JOptionPane.ERROR_MESSAGE);
}
If (!) (Aname.Equals("")) & & apass.equals("")))
{
If (aname. Equals("harshil") & & apass.equals ("harshil123"))
{
String s = "mactus"; If the user name and password is success enable editing in table in the main program
return s;
}
else if (! aname.equals ("mactus") & &! apass.equals ("mactus123"))
{
Aname.setText("");
Apassword.setText("");
}
}
Returns a null value.
}String.Equals (String)
String.equalsIgnoreCase (String)
-
get the return value of a method of the application module in the workflow
Hello
I use jdeveloper 11.1.1.7.0
I defined a method (return type is useful java card) in the Module of the Application and add this method to the client interface.
also I have a workflow and in this TF firstly I should execute this method and put the return value for the pageFlowScope parameter. I know that to use this method as a methodCall and set it as an activity by default, but I don't know how to get the return value before entering the jsff page and set the pageFlowScope parameter.
Habib
Concerning
When you add the activity to the way to deal, there are 'Return value' property that you can set to #{pageFlowScope.yourVariable}
Dario
-
DVT:pivotFilterBar - how to get the selected values of the filter
Hi all
I have a question: how to get the selected values from the pivot table filter bar programmatically?
I tried to use
but to the edge of the side DATA INCORRECTESdeclarations page, it seems that it will return the cached values.pivotTable.getDataModel().getDataAccess().getValueQDR(startRow, startCol, DataAccess.QDR_WITH_PAGE);
Environment: JDev 11.1.1.3.0 without tasks.
Thank you
MiroslawHello
You can retrieve the value selected in the PivotFilterBar through the PivotFilterBar model, instead of dataaccess:
Download the template of the bar pivot filter instance
QueryDescriptior queryDescriptor = (QueryDescriptor) pivotFilterBar.getValue ();retrieve a list of criterion, each of them is used to fill each lov in the pivot filter bar
ConjunctionCriterion conjunctionCriterion = queryDescriptor.getConjunctionCriterion ();
ListcriterionList = conjunctionCriterion.getCriterionList ();
for (int i = 0; i)<_criterionList.size(); i++)="">
AttributeCriterion = (AttributeCriterion) criterionList.get (i) criterion._selected is the currently selected value
Selected object = criterion.getValues () .get (0);System.out.println (_selected);
}Hope that helps,
Chadwick -
How to get the RGB value of a pixel in a psd document using scripting Photoshop
Hi, guys! Does anyone know how to get the RGB value of a pixel in a psd document using scripts in Photoshop? I myself have missed for a long time and could not resolve. I am very happy to hear your voice as soon as possible!
Here is an example...
var originalUnits = app.preferences.rulerUnits; app.preferences.rulerUnits = Units.PIXELS; var doc = activeDocument; var Colour1 = GetHexColour(eyeDropperRGB(1,doc.height-1)); var Colour2 = GetHexColour(eyeDropperRGB(20,doc.height-5)); var Colour3 = GetHexColour(eyeDropperRGB(40,doc.height-14)); alert("Colour 1 = " +Colour1 + "\rColour 2 = " +Colour2 + "\rColour 3 = " +Colour3); var decColour = eyeDropperRGB(40,doc.height-14); alert("Red = " +decColour[0] + "\rGreen = " +decColour[1] + "\rBlue = " +decColour[2]); app.preferences.rulerUnits = originalUnits; function GetHexColour(reqHex){ var out=''; for(No in colours = reqHex){ out = out.concat(zeroPad(d2h(reqHex[No]),2)); } return out; }; function eyeDropperRGB(x,y) { var x2 = x + 1; var y2 = y + 1; var out = new Array(3); activeDocument.selection.select([[x,y], [x2,y], [x2,y2], [x, y2]], SelectionType.REPLACE, 0, false); for(ch in list = ["Red", "Green", "Blue"]) { histogram = activeDocument.channels[list[ch]].histogram; for (i = 0; i <= 255; i++) { if (histogram[i]) { out[ch] = i; break; } } } return out; }; function d2h(d) {return d.toString(16);} function zeroPad(n, s) { n = n.toString(); while (n.length < s) n = '0' + n; return n; };
-
How to get the return in this example
Hi all,
In this simple example, is there an exception caused by the business logic. However, I would like to get the return value of 'p_dt' which will be stored in a table of newspaper, but when the exception occurs that the value is eliminated. How can I solve this? Thank you for your help.
SQL> select * from v$version where rownum = 1; BANNER -------------------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
Kind regardscreate table test as(select 1 id, to_date('01/01/2009','dd/mm/yyyy') dt from dual) / Create OR Replace Package Pkg_Test Is Procedure Prc_Call_Test; End Pkg_Test; / CREATE OR REPLACE Package Body Pkg_Test Is Procedure Prc_Test( p_id In Pls_Integer , p_dt OUT Date ) Is Begin SELECT DT INTO p_dt FROM TEST WHERE ID = p_id; If p_dt < Sysdate Then Raise_Application_Error(-20000, 'Anything'); End if; End Prc_Test; Procedure Prc_Call_Test Is v_dt Date; Begin Prc_Test(1, v_dt); Dbms_Output.put_line(v_dt); -- the return is null End Prc_Call_Test; End Pkg_Test; /
If you use NOCOPY in the parameter, then the value will be applied directly to the variable of output as it get set to so it will not be lost when the exception occurs. So, of course, to capture the exception or anything to access your dbms_output statement, but it is trivial...
SQL> ed Wrote file afiedt.buf 1 CREATE OR REPLACE Package Body Pkg_Test Is 2 Procedure Prc_Test( p_id In Pls_Integer 3 , p_dt OUT NOCOPY Date ) Is -- Note the use of NOCOPY on the parameter 4 Begin 5 SELECT DT 6 INTO p_dt 7 FROM TEST 8 WHERE ID = p_id; 9 If p_dt < Sysdate Then 10 Raise_Application_Error(-20000, 'Anything'); 11 End if; 12 End Prc_Test; 13 Procedure Prc_Call_Test 14 Is 15 v_dt Date; 16 Begin 17 BEGIN 18 Prc_Test(1, v_dt); 19 EXCEPTION 20 WHEN OTHERS THEN -- Capture the correct error here rather than OTHERS 21 dbms_output.put_line('Error occurred in prc_test'); 22 END; 23 Dbms_Output.put_line(v_dt); -- the return is null 24 End Prc_Call_Test; 25* End Pkg_Test; SQL> / Package body created. SQL> exec pkg_test.prc_call_test; Error occurred in prc_test 01/01/2009 00:00:00 PL/SQL procedure successfully completed. SQL>
-
How to get the decimal value of a string of international currency
Hi all
How to get the decimal values to a string of international currency.
Finally, we get to the real problem.
You can use location functions or write your own using string functions already mentioned...
http://developer.BlackBerry.com/native/documentation/Cascades/device_platform/internationalization/
-
How to get the fnd_profile.value in the host program
Hi all
How to get the FND_PROFILE. VALUE('ORG_ID') in the host program.
I loved not below, but it failed.
v_return =' $ORACLE_HOME/bin/sqlplus - s $FCP_LOGIN < < END
set pagesize 0
trigger the echo
fnd_profile. Value ('ORG_ID');
EXIT;
END '
echo $v_return
but it error with the message: Retrun value SP-0734: unknown command beginning "fnd_profile...". »
Kind regards
UVA
> but it error with the message: Retrun value SP-0734: unknown command beginning "fnd_profile...". »
.. .who is the same thing that will happen if you run SQL * more and type "fnd_profile.value...". »
Assuming that fnd_profile.value is a function, you must select from the something (say double) or assign to a variable.
-
How to get the internal values of Photoshop one ID assigned
I have difficulties to obtain values for the internal settings. It's less hard to set, you can use the Listener Script to get the code to use. Presumably, you use executeActionGet() with an ActionReference. The problem is to know how to build the ActionReference. It doesn't seem to be a lot of documentation on that.
My immediate problem is how to get the parameters of the 3D camera. I know this requires Photoshop Extended, but the principle must be the same. This code sucessfully defines these parameters:
< code >
function setPhotoshopCamera (angleX, angleY, angleZ, posX, posY, posZ) {}
Camera
var idGet3DCamera = stringIDToTypeID ("get3DCamera");
var idSet3DCamera = stringIDToTypeID ("set3DCamera");
var descCamera = new ActionDescriptor();
Camera position
var idKey3DCurrentCameraPosition =
stringIDToTypeID ("key3DCurrentCameraPosition");
var descCameraPosition = new ActionDescriptor();
var idkeythreeDXPos = stringIDToTypeID ("key3DXPos");
descCameraPosition.putDouble (idkeythreeDXPos, posX);
var idkeythreeDYPos = stringIDToTypeID ("key3DYPos");
descCameraPosition.putDouble (idkeythreeDYPos, posY);
var idkeythreeDZPos = stringIDToTypeID ("key3DZPos");
descCameraPosition.putDouble (idkeythreeDZPos, posZ);
var idkeythreeDXAngle = stringIDToTypeID ("key3DXAngle");
descCameraPosition.putDouble (idkeythreeDXAngle, angleX);
var idkeythreeDYAngle = stringIDToTypeID ("key3DYAngle");
descCameraPosition.putDouble (idkeythreeDYAngle, angleY);
var idkeythreeDZAngle = stringIDToTypeID ("key3DZAngle");
descCameraPosition.putDouble (idkeythreeDZAngle, angleZ);
descCamera.putObject (idKey3DCurrentCameraPosition,
(idKey3DCurrentCameraPosition, descCameraPosition);
These must be defined in the ActionDescriptor to make it work,// , but we do not have them
var idkeythreeDCurrentFStop = stringIDToTypeID ("key3DCurrentFStop");
descCamera.putDouble (idkeythreeDCurrentFStop, 0.000000);
var idkeythreeDCurrentFDist = stringIDToTypeID ("key3DCurrentFDist");
descCamera.putDouble (idkeythreeDCurrentFDist, 0.500000);
var idkeythreeDCurrentFocalPointX = stringIDToTypeID ("key3DCurrentFocalPointX");
descCamera.putDouble (idkeythreeDCurrentFocalPointX, 0.500000);
var idkeythreeDCurrentFocalPointY = stringIDToTypeID ("key3DCurrentFocalPointY");
descCamera.putDouble (idkeythreeDCurrentFocalPointY, 0.500000);
var idkeythreeDCurrentFOV = stringIDToTypeID ("key3DCurrentFOV");
descCamera.putDouble (idkeythreeDCurrentFOV, 30.000000);
var idkeythreeDOrthographic = stringIDToTypeID ("key3DOrthographic");
descCamera.putBoolean (idkeythreeDOrthographic, false);
var idkeythreeDOrthographicScale = stringIDToTypeID ("key3DOrthographicScale");
descCamera.putDouble (idkeythreeDOrthographicScale, 6.928203);
var idkeythreeDViewIndexString = stringIDToTypeID ("key3DViewIndexString");
descCamera.putString (idkeythreeDViewIndexString, "");var / / desc = executeAction (idSet3DCamera, descCamera, DialogModes.ALL);
return of ESCR;
}< code >
The problem is that it does not work unless you also set the lower elements. I want to leave what they are currently defined, but I don't know how to get these values. Apart from that, I'll get the values of position of camera beforehand. 9 ID, string or otherwise, this should be necessary are known from the top.
I assume you are using something like:
< code >
Var ref = new ActionReference();
ref.putIndex (idkeythreeDCurrentFStop, idkeythreeDCurrentFStop);
var / / desc = executeActionGet (ref);
< code >However, I was unable to get something to work. I am not sure
- That of the putXXX method to use.
- What to use for the desiredClass, which is the first argument.
Any help would be appreciated.
That you will get the 3DCurrentCameraPositon
var ref = new ActionReference(); ref.putEnumerated( zTID("Lyr "), zTID("Ordn"), zTID("Trgt") ); var desc = executeActionGet(ref).getObjectValue(stringIDToTypeID('layer3D')).getObjectValue(stringIDToTypeID('key3DState')).getObjectValue(stringIDToTypeID('key3DCurrentCameraPosition'));
Which returns a descriptor with the following keys.
Key 0 = key3DXPos: DescValueType.DOUBLETYPE
1 key = key3DYPos: DescValueType.DOUBLETYPE
2 = key3DZPos key: DescValueType.DOUBLETYPE
3 = key3DXAngle key: DescValueType.DOUBLETYPE
Key 4 = key3DYAngle: DescValueType.DOUBLETYPE
5 = key3DZAngle key: DescValueType.DOUBLETYPEAt least with my sample 3D layer. I don't really do a lot with the 3D, so there may be other keys.
-
Can I know how to get the 2 peak values v1 and v2 and 2 duration times t1 t2.
Since there is a small amplitude noise, difficult to use the Max simplely.
May need to use a filter such as wavelets or TREE to Denoise it first. Can I know how to use, any Toolbox in labview. How do the curve smooth first.
Thank you.
I can't watch your vi now (I'm at work), but if your signals are long enough, you might consider a median filter. You can set the number of points before and after use. I found that it is useful for some smoothing problems (not all).
Maybe you are looking for
-
Apple will add an SSD for my imac end 2012
I have an imac end of 2012. I want to add, and SSD drive to it to increase the speed of loading. I use photoshop and then CC. I really don't want to do it myself and can not find anywhere on the apple support site information they will or how long
-
Tengo mi license para windows xp don't home edition pero no encuentro donde bajar el programa
MI laptop lost the capacity for resturar known windows xp home edition pero tengo mi license validated. Where puedo bajar una version of windows xp home edition that can con activar license mi?
-
Hello. We used to install the SSD drives in HP-computers and use a Windows 7 OEM media to get a new installation of Windows, because the recovery DVD does not work. Usually associated with the different sizes from the on-board hard drive. Computers h
-
error code is P 10, I said sometimes when diagnosis tracking.
I have two identical computers using Windows Vista Home Premium and with built in the wireless, using a wireless router ("voice box" here in France), one works perfectly well the other suddenly seized upward and unable to connect with the Net. "Analy
-
How to turn on my hardware accelerator
Speed during DVD playback