Difference on variable _Ago
Hi,
I have created a variable 'Sold_Ago' and all is right..
but when I need to do the difference between 'Sold' and 'Sold_Ago' the system display the error:
Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 46036] Internal Assertion: Condition !levelJoinNodes.empty(), file .\Src\SQONPathJoinConstructor.cpp, line 882. (HY000)
SQL Issued: SELECT Misure.Delta saw_0 FROM Provvigioni
Can somebody help me?
thanks
Write once, debug ewerywhere. There should not be any
difference running pure Java code on difference
platforms.Umm.. "should" is the operative word..
Threads come to mind...as even when they are written as "Pure Java".. the native thread implementation can work harry cary (as opposed to Harry Potter) on your app...
Similar Messages
-
What is the difference between variable and Define
WHAT IS THE DIFFERENCE BETWEEN
these different declarations when it is done using the keyword "variable" and "define"
and both of these are done OUTSIDE "DECLARE"
VARIABLE g_monthly_sal NUMBER
DEFINE p_annual_sal =5000
-- I understand that p_annual_sal will be taken as a CHAR.
-- ALSO IF DEFINE variable acts as macro variable, SO is it necessary to give it some value whenever we define it.
if not what value would be substituted for it?
OR does that mean whenever we want to specify data type for a bind varible we should use VARIABLE and
when we do not want to specify type we use DEFINE?
THANK YOU
Edited by: user6287828 on Feb 24, 2009 11:03 AM
Edited by: user6287828 on Feb 24, 2009 11:04 AMBoth are SQL*plus commands. In a real programming environment you will not use such constructs (except a few rare scripting cases).
The difference is how the construct is later used. DEFINE is more like a copy&paste string. Whereever the name of this substitution variable is found it will be pasted into the sql*plus session.
VARIABLE creates a real variable. You can change the value and if follwos the usual principles of variables (including binding).
Example can be found the docs:
from the docs
Where and How to Use Substitution Variables
You can use substitution variables anywhere in SQL and SQL*Plus commands, except as the first word entered. When SQL*Plus encounters an undefined substitution variable in a command, SQL*Plus prompts you for the value.
You can enter any string at the prompt, even one containing blanks and punctuation. If the SQL command containing the reference should have quote marks around the variable and you do not include them there, the user must include the quotes when prompted.
SQL*Plus reads your response from the keyboard, even if you have redirected terminal input or output to a file. If a terminal is not available (if, for example, you run the script in batch mode), SQL*Plus uses the redirected file.
After you enter a value at the prompt, SQL*Plus lists the line containing the substitution variable twice: once before substituting the value you enter and once after substitution. You can suppress this listing by setting the SET command variable VERIFY to OFF.
Using Bind Variables
Bind variables are variables you create in SQL*Plus and then reference in PL/SQL or SQL. If you create a bind variable in SQL*Plus, you can use the variable as you would a declared variable in your PL/SQL subprogram and then access the variable from SQL*Plus. You can use bind variables for such things as storing return codes or debugging your PL/SQL subprograms.
Because bind variables are recognized by SQL*Plus, you can display their values in SQL*Plus or reference them in PL/SQL subprograms that you run in SQL*Plus.
Creating Bind Variables
You create bind variables in SQL*Plus with the VARIABLE command. For example
VARIABLE ret_val NUMBER
This command creates a bind variable named ret_val with a datatype of NUMBER. See the VARIABLE command for more information. (To list all bind variables created in a session, type VARIABLE without any arguments.)
Referencing Bind Variables
You reference bind variables in PL/SQL by typing a colon (:) followed immediately by the name of the variable. For example
:ret_val := 1;
To change this bind variable in SQL*Plus, you must enter a PL/SQL block. For example:
BEGIN
:ret_val:=4;
END;
/ -
What is the difference btwn Variable Substitution and Dynami Configuration
Hi Gurus
Could you please explain the difference between the Variable Substituion and Dynamic Configuration.
whn shall we use them and in what scenarios?
thanx in advancePlease go through this blog
/people/shabarish.vijayakumar/blog/2009/03/26/dynamic-configuration-vs-variable-substitution--the-ultimate-battle-for-the-file-name
Also this
/people/madanmohan.agrawal/blog/2009/05/20/combining-three-different-aspects-of-pi-asma-af-module-and-variable-substitution-in-one-shot
Edited by: Baskar Gopal on Mar 31, 2011 9:04 AM -
IDocumaker - Difference in variable contents in "preview" and "edit" options
Hi Experts,
We work on iDocumaker v3.2 and facing a strange issue.
1) We have FORM level overflow for a letter which is triggered more than once based on Co-owner information coming in XML; this is a repeating block.
2) Assuming, A, B, C are primary owner and respective co-owners on a policy, my letter is printing 3 times, with A, B, C's address.
3) I use KICKTOWIP, to send the transaction in WIP Queue, from where I pull it from iDocumaker.
4) When I do a preview of the transaction in WIP Search, I am able to see the letters in order , A , B, C
5) When I click on Edit button, I still can see the same FORM, say LETTER occurring thrice, for A, B, C
6) However, when I click on "Work on Forms" ; all three images/FORMS are initialised with A's data ONLY.. there is no B or C data in subsequent images.
Can someone help me out with this mess?
We use IDS v3.2 and SQL 2008 as database.
Thanks,
Pradip KumarThe most likely answer is to edit the section and click on each field. In the Attribute section of the properties, change the scope from Global to either Form or Section.
Entry propagates globally scoped fields throughout the entire transaction. Form scope propagates to all the sections within the same occurrence of the form. So if you set the fields to Form or Section scope, you should be fine. Remember to regenerate any existing WIP, as the ones you previously ran will continue to have the fields defined as global scope. -
Difference between Multiple single values and Selection option variables
Hi !
Can any one tell me the difference between variable types:
Multiple single values and Selection option?
I used each one of them for selecting values for a characteristic but could not notice a difference in choosing values.
Is there some difference in functionality or can they be used interchageably?
Regards,
Sri HarshaHarsha,
When you go for slection option, in the variable input screen you will be having a button in the last where you can give your slections. There you can maintain either multiple single values and Multiple intervals or else not equal to also..
Just check out there... you will be having tabs for each..
Assign Points if it helps
Gattu -
Difference b/w DATA TYPE and DATA OBJECT & differences b/w TYPE and LIKE
hai
can any one say the differences between Data type and Data Object.
And also differences between TYPE and LIKE
thanks
Ganihi,
_Data Types and Data Objects_
Programs work with local program data that is, with byte sequences in the working memory. Byte sequences that belong together are called fields and are characterized by a length, an identity (name), and as a further attribute by a data type. All programming languages have a concept that describes how the contents of a field are interpreted according to the data type.
In the ABAP type concept, fields are called data objects. Each data object is thus an instance of an abstract data type. There are separate name spaces for data objects and data types. This means that a name can be the name of a data object as well as the name of a data type simultaneously.
Data Types
As well as occurring as attributes of a data object, data types can also be defined independently. You can then use them later on in conjunction with a data object. The definition of a user-defined data type is based on a set of predefined elementary data types. You can define data types either locally in the declaration part of a program using the TYPESstatement) or globally in the ABAP Dictionary. You can use your own data types to declare data objects or to check the types of parameters in generic operations.
All programming languages distinguish between various types of data with various uses, such as .. type data for storing or displaying values and numerical data for calculations. The attributes in question are described using data types. You can define, for example, how data is stored in the repository, and how the ABAP statements work with the data.
Data types can be divided into elementary, reference, and complex types.
a. Elementary Types
These are data types of fixed or variable length that are not made up of other types.
The difference between variable length data types and fixed length data types is that the length and the memory space required by data objects of variable length data types can change dynamically during runtime, and that these data types cannot be defined irreversibly while the data object is being declared.
Predefined and User-Defined Elementary Data Types
You can also define your own elementary data types in ABAP using the TYPES statement. You base these on the predefined data types. This determines all of the technical attributes of the new data type. For example, you could define a data type P_2 with two decimal places, based on the predefined data type P. You could then use this new type in your data declarations.
b. Reference Types
Reference types are deep data types that describe reference variables, that is, data objects that contain references. A reference variable can be defined as a component of a complex data object such as a structure or internal table as well as a single field.
c. Complex Data Types
Complex data types are made up of other data types. A distinction is made here between structured types and table types.
Data Objects
Data objects are the physical units with which ABAP statements work at runtime. The contents of a data object occupy memory space in the program. ABAP statements access these contents by addressing the name of the data object and interpret them according to the data type.. For example, statements can write the contents of data objects in lists or in the database, they can pass them to and receive them from routines, they can change them by assigning new values, and they can compare them in logical expressions.
Each ABAP data object has a set of technical attributes, which are fully defined at all times when an ABAP program is running (field length, number of decimal places, and data type). You declare data objects either statically in the declaration part of an ABAP program (the most important statement for this is DATA), or dynamically at runtime (for example, when you call procedures). As well as fields in the memory area of the program, the program also treats literals like data objects.
A data object is a part of the repository whose content can be addressed and interpreted by the program. All data objects must be declared in the ABAP program and are not persistent, meaning that they only exist while the program is being executed. Before you can process persistent data (such as data from a database table or from a sequential file), you must read it into data objects first. Conversely, if you want to retain the contents of a data object beyond the end of the program, you must save it in a persistent form.
Declaring Data Objects
Apart from the interface parameters of procedures, you declare all of the data objects in an ABAP program or procedure in its declaration part. These declarative statements establish the data type of the object, along with any missing technical attributes. This takes place before the program is actually executed. The technical attributes can then be queried while the program is running.
The interface parameters of procedures are generated as local data objects, but only when the procedure is actually called. You can define the technical attributes of the interface parameters in the procedure itself. If you do not, they adopt the attributes of the parameters from which they receive their values.
ABAP contains the following kinds of data objects:
a. Literals
Literals are not created by declarative statements. Instead, they exist in the program source code. Like all data objects, they have fixed technical attributes (field length, number of decimal places, data type), but no name. They are therefore referred to as unnamed data objects.
b. Named Data Objects
Data objects that have a name that you can use to address the ABAP program are known as named objects. These can be objects of various types, including text symbols, variables and constants.
Text symbols are pointers to texts in the text pool of the ABAP program. When the program starts, the corresponding data objects are generated from the texts stored in the text pool. They can be addressed using the name of the text symbol.
Variables are data objects whose contents can be changed using ABAP statements. You declare variables using the DATA, CLASS-DATA, STATICS, PARAMETERS, SELECT-OPTIONS, and RANGESstatements.
Constants are data objects whose contents cannot be changed. You declare constants using the CONSTANTSstatement.
c. Anonymous Data Objects
Data objects that cannot be addressed using a name are known as anonymous data objects. They are created using the CREATE DATAstatement and can be addressed using reference variables.
d. System-Defined Data Objects
System-defined data objects do not have to be declared explicitly - they are always available at runtime.
e. Interface Work Areas
Interface work areas are special variables that serve as interfaces between programs, screens, and logical databases. You declare interface work areas using the TABLES and NODESstatements.
What is the difference between Type and Like?
Answer1:
TYPE, you assign datatype directly to the data object while declaring.
LIKE,you assign the datatype of another object to the declaring data object. The datatype is referenced indirectly.
Answer2:
Type is a keyword used to refer to a data type whereas Like is a keyword used to copy the existing properties of already existing data object.
Answer3:
type refers the existing data type
like refers the existing data object
reward if useful
thanks and regards
suma sailaja pvn -
Enforce setting private variable in subclass with abstract method
Hi,
Is this something that is common usage/practice?:
public abstract class Base {
private int importantPrivateVariable = setImportantPrivateVariable();
protected abstract int setImportantPrivateVariable();
}I would like to enforce the extender of the class to set a private variable, but as there is no abstract variable in java, I can only use a method for it.
Thanks,
lemonboston
Edit: the variable could be protected as well, I suppose this is not important here, but correct me if I am wronglemonboston wrote:
Hi,
Is this something that is common usage/practice?:I don't think that's so common, but that's code easily understandable. However there are several problems with this approach:
public abstract class Base {
private int importantPrivateVariable = setImportantPrivateVariable();
protected abstract int setImportantPrivateVariable();
}I would like to enforce the extender of the class to set a private variableThat's no what your code implements: your base class forces the subclasses to return an int value, and the Base class uses that value to assign it to the variable.
Therefore the method should be called get<Something> (e.g. <TT>getInitialValueOfImportantVariable()</TT>+ to have a naming consistent with its signature (it returns a value, whereas a regular setter method should declare a void return type: <TT>protected abstract void setImportantPrivateVariable(int someValue);</TT>).
Edit: the variable could be protected as well, I suppose this is not important here,Well, yes, this is "important" - at least, there a noticeable difference: the variable being private, the base class is free to handle it as it sees fit (e.g., assign the value at construction time and never modify it afterwards). If the variable was protected, the subclass could modify in ways and at times not known by the base class.
but correct me if I am wrongThere's a trap in this construct: the method is called in the variable initializer, that is, behind the scenes, approximately during the execution of the Base class constructor, so before the subclass constructor. So, you are calling a method on an object that is not fully initialized (e.g. some of its attributes may still be <TT>null</TT> at this stage). There is a rule that discourages such situations, that goes something like "don't call non-private and non-final methods from a constructor".
To avoid this trap, two options:
- require an int argument in the Base class's constructor , as was suggested above
- don't get and set the value of the important variable in the initializer or constructor code, but from a special method in the base class instead:
public abstract class Base {
private int importantPrivateVariable; // default value is zero
// or alternatively:
// private int importantPrivateVariable = ...; // Some default value
protected abstract int getImportantPrivateVariable();
public void initializeImportantPrivateVariable() {
importantPrivateVariable = getImportantPrivateVariable();
}That construct is a degenerate form of a common design pattern known under the name of Template Method (where a base class method calls generally several subclass methods in a specified order and with a specified chaining, leaving it to the subclass to implement the details of the methods).
The drawback is that the client code (the one that uses the Base instance) has to know when to call that initialization method, whereas the constructor-based initialization lets the client code free to not care at all.
Much luck,
J. -
Good day to all,
I have a question related to VB.
Is there any way to use Bind variables in VB, or any other way, that my same query will not parse every time in Oracle just for a little difference in variable field..
Regards
AnsYou'd use OracleParameters. I dont do VB.NET, but here's a c# example you should be able to easily convert.
Hope it helps,
Greg
using (OracleConnection con = new OracleConnection("user id=scott;password=tiger;data source=orcl"))
con.Open();
using (OracleCommand cmd = new OracleCommand("", con))
cmd.CommandText = "insert into emp (empno, ename) values (:e1, :e2)";
cmd.Parameters.Add(new OracleParameter("e1",OracleDbType.Int32,0,1234,ParameterDirection.Input));
cmd.Parameters.Add(new OracleParameter("e2",OracleDbType.Varchar2,4,"KING",ParameterDirection.Input));
cmd.ExecuteNonQuery();
Console.WriteLine("done");
} -
Simple use of variables in query
Hi,
i've just started using PL/SQL and as a long time user of TSQL the syntax is a bit confusing for me. I'm trying to test a simple query - using a variable to select some rows from a table. Lest assume that we have a table with data from different days and we want to view data from specific day.
I could use:
SELECT * FROM TABLE
where TRADE_DATE = '2010-10-23'
but what i would like to do is to pass the date value as a variable, in TSQL i'd just write:
declare @trade_date datetime
set @trade_date = '2010-10-23'
SELECT * FROM TABLE
where TRADE_DATE = @trade_date
Could someone help me and write the last query using PL/SQL syntax?
Also - it there some kind of a tutorial for people like me? comparison of simple queries written in both languages? tried to google it but didn't have luck.There are a couple of differences besides variable syntax. The variable would look like this in PL/SQL:
declare
v_trade_date date := DATE '2010-10-23';
begin
select * into ????? -- see below
from table
where trade_date = v_trade_date;
end;However the next difference is that PL/SQL does not implicitly return result sets to the client application, so you either have to select <b>into</b> a PL/SQL variable, or process the values in a loop, or explicitly return a ref cursor (or just do the processing in SQL statements within the procedure, without returning anything). I don't know much about T-SQL but I have the impression that in Oracle there is a stronger distinction between SQL (the interpreted query language) and PL/SQL (the compiled programming language) than the equivalents in SQL Server. Saubhik's example above is not PL/SQL (which you asked about) but plain SQL.
Using the example of SQL*Plus, you might use a ref cursor like this:
var r refcursor;
declare
v_trade_date date := DATE '2010-10-23';
begin
open :r for
select *
from test_table
where trade_date = v_trade_date;
end;
print :ror
var r refcursor;
create or replace procedure p (p_out_results out sys_refcursor)
as
v_trade_date date := DATE '2010-10-23';
begin
open p_out_results for
select *
from test_table
where trade_date = v_trade_date;
end p;
set autoprint on
exec p(:r)Edited by: William Robertson on Oct 24, 2010 5:31 PM -
Variable namespaces in ALSB - creation -
Hi ,
Can anyone tell how to create variable namespaces in ALSB . What is the difference between Variable and UserDefined namespaces. I have searched the docs, and they explain only about Variable structures. Any help greatly appreciated. I am using ALSB 3.0 on WLS 10.
Edited by: kasi.s on 21-Nov-2009 04:47Hi Anuj,
Thanx for answering,
The variable namespaces apears in the same section(at the left) where the defined and default namespaces are located, and it seems to populate those from what you have difined in your WSDL but when you modify the WSDL this are not refreshed and you can have in there old namespaces not used any where else.
Kind Regards!! -
Please advise what is the difference between Variables and Filters.
Hi,
they are two different stuffs altogether ....filters if excluded will not show that data in the report for those values...if included will show data only satisfying that condition.....variables on the other hand are used to give input values or values derived from other characteristics based on the logic thrugh exits at the runtime of the query...these input can be used to restrict key figures and also in the global filter values...that is the values of the global filters can be dynamic too... populated thrugh variables.....
Thanks -
Cost component not splitting at the time of Rune the tine of Cost Estimate
http//
Hi,
We are in developing phase for Product costing for coal mine project ,
we have raise coal material with Non component BOM , and Routing is only one activity with 400- Raised Coal Qty-MT ,
We upload the plan with Production cost center -activity type and cost element ( as per cost component -we have 10 cost component as per below )
RM - Blasting
Production Overhead
Power - Main
Stores,Spare,Consum
Repairs & Maint
Lease & Hire Char-PM
Power - Auxiliary
Depreciation
Over Burden
Development
we done the plan for Amount and Qty by KP06,KP26 and update plan price but system not calculate the cost component splitting in cost estimate as per planning while only one item showing for all cost to Production Overhead cost component
Production Overhead cost component which assign the secondary cost element which is assign to activity type 400
can any one help me to how we can resolve this issue
Please find attached documentHi,
Here I am providing the necessity and importance of splitting structure, will share the configuration steps once you go through the following and get the comfort level.
Expense Analysis and Splitting in Manufacturing Cost Centers
Introduction In SAP Cost center work as a cost responsibility center, where all the expenses and cost are stored and analyzed for the purpose of management decision making.
The cost could be fixed or variable in nature. The difference between variable and fixed costs can be made in various ways in product costing in CO module.
Fixed costs represent the static costs incurred by the organization, which doesn’t change on the basis on manufacturing activities, which remain constant irrespective of production activities like rent for the premises, salaries of office staff etc.
On the other hand, variable cost varies based on the level of production activities; if production activities increase then variable cost also increased like electricity consumes raw material charges etc.
However all the variable cost doesn’t vary in direct proportion by quantity of goods produced.
In this document will try to define; how the Expenses analysis and splitting of cost done in manufacturing cost centers.
From controlling prospective, fixed cost remain constant regardless of operating activities, but if these factor changes, variable cost will fluctuate.
Basically raw material costs represent variable cost, but in this document main focused will be given to distinguish fixed and variable activity cost.
The segregation between fixed and variable cost is optional and is derived from the configuration and master data configured in cost center accounting and overhead accounting.
Activity Price:
There are different methods that could be used in cost center accounting to determine the activity price. The simple way is the manually enter “Fixed” and “Variable” Activity cost (KP26).
However there are other methods used in Cost center Planning and Budgeting that automatically calculate the fixed and variable activity price.
Here the focused will be given on Planning and Budgeting activity and automatic calculation of plan activity rate in cost center.
This method aggregate planned costs by cost element and capacity by plan unit to calculate the activity price.
Activity independent costs are segregated among different activities based on Splitting Structure, while activity dependent cost directly used for the purpose of variable activity rate calculation.
Fixed Activity Cost:
In product costing all those cost, which doesn’t vary based on the activities in manufacturing cost will represent fixed cost.
In a manufacturing cost centers there may be two or more activities performed.
To calculate the activities rate, the fixed costs are distributed to various activities on the basis of Splitting Structure defined for cost center.
Variable Activity Cost:
Variable activity cost, which directly depend upon the activity type and fluctuate based on increase or decrease in manufacturing activities. In SAP variable activity cost are directly linked to the respective activity.
Activity Prices: Fixed and Variable Split
In Cost Center Accounting dividing the cost between Fixed and Variable requires appropriate split to be made in the cost entered for the activity. The process is described below:
i. Variable cost would be planned at activity level and expenses should be maintained at cost element in the manufacturing cost center by assigning activity and cost element combination.
In other word, the expenses should be planned on Activity type at the time of primary cost planning (KP06).
Then the variable activity rates are calculated on Total cost planned at Activity divided by Total number of activity planned at that cost center (i.e. capacity in KP26)
ii. Fixed cost would be planned at independent of activity type. These costs are maintained in KP06 at cost element level on manufacturing cost center.
Then the fixed costs are distributed on various activity types on the basis of Splitting structure defined at OKEW.
In Splitting Structure we define the rules, how the fixed cost will be distributed to Activities. For the purpose of this document, considering split of fixed cost on the basis of Capacity maintained in KP26.
Regards,
Pavan kumar Arvapally -
How can i set signature creation/modification time at signature creation?
Hi,
I have an acrobat plugin (PubSec), written using sdk 9 and running on acrobat x. i have noticed that after creating a new signature using my plugin the signing time i put in the signature appearance is different from the "M:" entry in signature dictionary. I tried the same process (i.e signature creation) using adobe's default plugin but this time there was no discrepency in datetime values.
The time difference is variable, usually a couple of seconds. I have tried to set the "M:" entry in signature dictionary "V" via the following code in the
SigGetProperties() callback:
void DSEngine::sigGetSigProperties( PSSigSigPropParams params )
std::string dateString = "20110518163011+04'00'"; // here i have used current time as well but doesnt work
// used "D:
20110518163011+04'00'
" version as well but no use.
ASText dateText = ASTextFromScriptText ((const char*)dateString.c_str(), kASRomanScript);
ASCabPutText(params->outNewSigPropCab, PROP_SigProp_Date, dateText);
Please help me remove this time difference.
Who sets "M:" value and at which point during signature creation (i mean in which callback)?
Is above code the right way to set "M:" entry (i.e. signing time) of signature dictionary "V"?
Is the sigGetSigProperties() callback the right place to put this code?
ThanksAs far as I'm aware GarageBand for iPad only supports 4/4 time, at least in it's present form.
tt2 -
PDW : Hierarchy parent/child
Hi,
I'm working with a PDW Appliance as source and destination.
I need to create a parent/child hierarchy.
My child surrogate key is generated inside my dataflow, then I'm doing the initial loading of all my data minus the surrogate key for the parent column.
I'd like to avoid to run update statements against my destination table (because of the replication) and/or have to create temp tables.
I thought about keeping in memory (Recordset Destination) all my dataset and then doing the look up in a script component before doing the final insert in append mode but the performance are awful.
Any idea ?
Thx for your help.
BertrandrThanks to have remind me about the CacheTransform component :)
The dataset is about 200 000 rows.
I have also tested another option.
Instead of performing an initial load and then look up
I'm doing a multicast pointing to 2 RecordSet Destination.
Both are the same except it's 2 differents object variables.
Then in another dataflow I read both dataset and use a MergeJoin on the business key to get my parent surrogate key.
It works but I need to compare performances with your solution.
Thanks a lot !
Bertrandr -
How to use parameters in oracle SQL script????
Right now I am writing a SQL script to create a schema and build the objects of this schema....
I use a .net winform program to run sqlplus to parse this sql script ...
The problem is that the schema name and the tablespace's location and the sys password must be input by the user, so my SQL script should use these runtime input parameters instead of const parameters....
So, how to use parameter in SQL script ...........
Are there some example scripts in oracle home directory for me to refer to????Hi,
UNISTD wrote:
thanks .....
what's the difference between variable , define, accept in sqlplus ???VARIABLE declares (but does not assign a value to) a bind variable. Unlike substitution variables, bind variables are passed to the back end to be compiled, and they can only be values in certain data types. You can not use a bind vaiable in place of an identifier, so to do something like
CREATE USER &1 ...a bind variable won't work.
"DEFINE x = y" sets the substitution variable &x to have the value y. There is no user interaction (unless x or y happen to contain undefined substtiution variables).
"DEFINE x" shiows the value of the substitution variable &x, or, if it is undefined, raises a SQL*Plus error. I use this feature below.
ACCEPT sets a substitution variable with user interaction.
And if the user miss some parameters in “sqlplus /nolog ssss.sql par1 par2 par5 par6”, how to use default value of the miss parameters??Don't you need a @ befiore the script name, e.g.
sqlplus /nolog @ssss.sql par1 par2 par5 par6Sorry, I don't know of any good way to use default values.
The foloowing works, but, as you can see, it's ugly.
"DEFINE 1" display a message like
DEFINE 1 = "par1" (CHAR)if &1 is defined; otherwise,it will display a SQL*Plus error message like
SP2-035: symbol 1 is UNDEFINEDNotice that the former contains an '=' sign, but the latter does not.
The best way I know to use default values is to run the DEFINE command, save the output to a filee, read the file, and see if it's an error message or not.
So you can use a script like this:
-- This is DEFINE_DEFAULT.SQL
SPOOL got_define_txt.sql
DEFINE &dd_old
SPOOL OFF
COLUMN dd_new_col NEW_VALUE &dd_new
WITH got_define_txt AS
SELECT q'[
@got_define_txt
]' AS define_txt
FROM dual
SELECT CASE
WHEN define_txt LIKE '%=%'
THEN REGEXP_REPLACE ( define_txt
, '.+"
([^"]*)
, '\1'
ELSE '&dd_default'
END AS dd_new_col
FROM got_define_txt
{code}
and start your real script, ssss.sql, something like this:
{code}
DEFINE dd_new = sv1
DEFINE dd_old = 1
DEFINE dd_default = FOO
@DEFINE_DEFAULT
DEFINE dd_new = sv2
DEFINE dd_old = 2
DEFINE dd_default = "Testing spaces in value"
@DEFINE_DEFAULT
{code}
when this finishes running, the substitution variable &sv1 will either have the value you passed in &1 or, if you didn't pass anything, the default value you specified, that is FOO.
Likewise, &sw2 will have the value you passed, or, if you didn't pass anything, the 23-character string 'Testing spaces in value'.
Here's how it works:
Define_default.sql puts the output of the "DEFINE x" command into a column, define_txt, in a query. That query displays either the existing value of the substitution variable indicated by &dd_old or, if it is undefined, the default value you want to use, which is stored in the substitution variable &dd_default. The substitution variable named in &dd_new is always set to something, but that something may be its existing value.
Notice that the paramerters to define_default.sql must be passed as global varibales.
Why didn't I just use arguments, so that we could simply say:
{code}
@DEFINE_DEFAULT sv1 1 FOO
{code}
? Because that would set the substitution variables &1, &2 and &3, which are miost likely the very ones in which you're interested.
I repeat: there must be a better way, but I'm sorry, I don't know what it is.
I usually don't do the method above. Instead, I always pass the required number of parameters, but I pass dummy or plce-holder values.
For example, if I wanted to call ssss.sql, but use defulat vlaues for &1 and &3, then I would say something like:
{code}
@ssss ? par2 ?
{code}
and, inside ssss.sql, test to see if the values are the place holder '?', and, if so, replace them with some real default value. The use has to remember what the special place holder-value is, but does not need to know anything more, and only ssss.sql itself needs to change if the default values change.
Maybe you are looking for
-
Event Structure Freezes Vi After Capturing The First Event
My Event structure catches the first instance of my button press but then it freezes my Vi. The reason is because of the while loop but I need the while loop to constantly read from a serial port and send data to a serial port. The vi included is st
-
?getting songs from ipod to new computer?
hello everyone. i just bought a new computer and have itunes installed on it. when i plug in my ipod my songs come up and i can play them in itunes from my ipod. I cant however, get the songs off of my ipod to my library in itunes on my computer.
-
ok, when i try downloading some of my songs, they will stop at the end and error -1000000 will pop up. what should i do to fix it? it happens ALL the time and it is VERY frustrating.
-
Some characters from xerces are ?. j2sdk1.3 doesn't do this.
Hi, I used to use j2sdk1.3 and now I'm using j2sdk1.4.1, and I wrote a program befor that uses Xerces that reads various strange character entities which are then stored in a hashmap with the idea of translating certain weird characters into normal c
-
Change default communication port for BITS
We are currently using ConfigMgr2007 (native mode). We currently have a global GPO wihich is throttling BITS to 56kpbs during current business hours (8am-5pm). It has been suggest to use QoS to controll the amount of traffic used by SCCM distributi