SP return parameters in select statment
how is it possible to return SP parameters(north, east etc) in select query under SP
your help is appreciated.
Hi,
user8723008 wrote:
how is it possible to return SP parameters(north, east etc) in select query under SP
PROCEDURE sp_a_DetailOutput
north IN Float,
east IN Float,
south IN Float,
west IN Float,
id IN varchar2,
resultData OUT sys_refcursor
) As
begin
declare lid number := to_number(id);
Begin
for rec in (select geometry from acd a where a.id=lid)
loop
OPEN resultData FOR
SELECT w.id, w.description, w.geometry, north as n, east as e FROM Acr w
where SDO_NN(w.GEOMETRY, (rec.geometry))='TRUE' AND ROWNUM<=1;
end loop;
END;
end sp_a_DetailOutput;
your help is appreciated.What's the problem with the code you posted?
Any place where you can use an expression in a SQL statement, you can use a variable, including an argument. Just make sure that the variable name can't be mistaken for a column name. (E.g, if the table has a column called north, then you'd better name the argument something else, such as p_north.)
For example, if you pass 54.666667 as the argument north, then the code you wrote as
SELECT north AS n ...is executed as if you had written:
SELECT 54.666667 AS n ...I don't think your problem really has anything to do with Oracle Spatial.
Can you post a similar problem, that doesn't involve Spatial, just a PL/SQL procedure that needs to use its arguments in a query? Post CREATE TABLE and INSERT statements for some sample data, and post what you want the procedure to do given some different arguments and that data.
If your question really is specific to Spatial, then post it in the Spatial forum:
Spatial
and mark this thread as "Answered".
Similar Messages
-
How do I get return parameters from a stored procedure call?
The Open SQL Statement has an option on the Advanced tab to specify a command type of 'stored procedure'. In addition to returning a recordset, a stored procedure can also return parameters (see http://support.microsoft.com/support/kb/articles/Q185/1/25.ASP for info on doing this with ADO). Is it possible to get those return parameters with TestStand? In particular, I want to be able to get error codes back from the stored procedure in case it fails (maybe there is another way).
The Open SQL Statement step type does not fully support stored procedures. If the procedure returns a record set than you can fetch the values as you would a SELECT statement. Stored procedures require you to setup the parameters before the call and this is not yet supported. Bob, in his answer, made a reference to the Statements tab and I think that he was talking about the Database Logging feature in TS 2.0.
If the stored procedure is returning a return value, it may return as a single column, single row recordset which can be fetched as you normally do a record set.
Scott Richardson
National Instruments -
Parameters and Select Option in ABAP OO
Hi all,
it's possible to build an application starts with a method of a class thats declares parameters and select-option or I have to do it custom creating a dynpro and some input field as parameters?
thanks
enzoJust to add detail: the function module RS_REFRESH_FROM_SELECTOPTIONS returns a table of TYPE RSPARAMS_TT.
The structure of this table is:
SELNAME
RSSCR_NAME
KIND
RSSCR_KIND
SIGN
TVARV_SIGN
OPTION
TVARV_OPTI
LOW
TVARV_VAL
HIGH
TVARV_VAL
the first field is the name of the selection parameter, the others have the same structure obtained declaring a range with:
TYPES|DATA <rangetab> TYPE RANGE OF <type>.
see the help topic http://help.sap.com/saphelp_470/helpdata/en/9f/dba71f35c111d1829f0000e829fbfe/content.htm -
Hi ,
what is the difference between,select single and
select upto one row .
In a select statment .
Thanks ,
shankar.According to SAP Performance course the SELECT UP TO 1 ROWS is faster than SELECT SINGLE because you are not
using all the primary key fields.
select single is a construct designed to read database records with primary key. In the absence of the primary key,
it might end up doing a sequential search, whereas the select up to 1 rows may assume that there is no primary key
supplied and will try to find most suitable index.
The best way to find out is through sql trace or runtime analysis.
Use "select up to 1 rows" only if you are sure that all the records returned will have the same value for the field(s)
you are interested in. If not, you will be reading only the first record which matches the criteria, but may be the
second or the third record has the value you are looking for.
The System test result showed that the variant Single * takes less time than Up to 1 rows as there is an additional
level for COUNT STOP KEY for SELECT ENDSELECT UP TO 1 ROWS.
The 'SELECT SINGLE' statement selects the first row in the database that it finds that fulfils the 'WHERE' clause
If this results in multiple records then only the first one will be returned and therefore may not be unique.
Mainly: to read data from
The 'SELECT .... UP TO 1 ROWS' statement is subtly different. The database selects all of the relevant records that
are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns
the first record of the result set.
Mainly: to check if entries exist.
You can refer to the below link..
http://www.sap-img.com/abap/difference-between-select-single-and-select-upto-one-rows.htm -
Using distinct and orderby in the select statment
Hi All,
Can anyone tell me what is the purpose of using distinct and orderby in the select statment.Hi,
Using the distinct function with more than one column yields some substantial results. SQL will return the rows with distinct or unique combinations of those columns. Assume this same employee table has another column including the salary of each employee. With the use of the distinct function we can pull a list of unique job titles - salaries.
SQL Code:
SELECT DISTINCT job_titles, salary FROM employees;
SQL has returned all the rows with unique combinations of job titles and salaries. Any duplicate combinations of job titles and salaries will be ignored. For example if we had two CEOs in the table making the same salary each year, only one row would be returned but if we had two CEOs with different salaries, both rows would be returned.
Order by
The SQL ORDER BY clause comes in handy when you want to sort your SQL result sets by some column(s). For example if you want to select all the persons from the already familiar Customers table and order the result by date of birth, you will use the following statement:
SELECT * FROM Customers
ORDER BY DOB
As you can see the rows are sorted in ascending order by the DOB column, but what if you want to sort them in descending order? To do that you will have to add the DESC SQL keyword after your SQL ORDER BY clause:
SELECT * FROM Customers
ORDER BY DOB DESC
If you don't specify how to order your rows, alphabetically or reverse, than the result set is ordered alphabetically, hence the following to SQL expressions produce the same result:
SELECT * FROM Customers
ORDER BY DOB
SELECT * FROM Customers
ORDER BY DOB ASC
You can sort your result set by more than one column by specifying those columns in the SQL ORDER BY list. The following SQL expression will order by DOB and LastName:
SELECT * FROM Customers
ORDER BY DOB, LastName
if its useful reward points -
Hi all,
I am trying to put select statment into another select statment.
Select column1
,column2
,column3
,(select column1 from table1,table2,table3 where condotions...)
,column4
from table 1.
its giving me error.
Please help me...its urgent.
SurenderSQL> select deptno,dname,(select ename from emp) from dept;
select deptno,dname,(select ename from emp) from dept
ERROR at line 1:
ORA-01427: single-row subquery returns more than one row
SQL> select deptno,dname,(select ename from emp where empno=7934) from dept
DEPTNO DNAME (SELECTENA
10 ACCOUNTING MILLER
20 RESEARCH MILLER
30 SALES MILLER
40 OPERATIONS MILLER
In your case subquery is returning more than one row. It should not be.
-aijaz
Message was edited by:
[email protected] -
How does "SELECT" statment work?
Hi,
Correct me if I'm wrong.
Data selected by SELECT statement (without ORDER BY) is unordered and sequence of selected lines may differ every time you execute the same SELECT.
My problem is that data on a production system has been always selected ordered ( without ORDER BY) and suddenly it changes and the rows of a result set are unordered.
It's also strange for me that it works differently on a test system and data is selected ordered ( the code is the same on both systems ).
Two questions:
1. How is it possible that data was always selected ordered? (the only answer which comes to my head is "LUCK" )
2. What has happened that data is now selected unordered? (and works as SELECT statment should work by definition)
Thanks for any ideas,
MarioHello,
I see there is an equality 3-3 in the match here, between
1) those who are for "it's ordered" (Rodrigo Ariel G..., Danish2285, pavankumar.g)
2) and those "it's not ordered" (Diwakar Aggarwal, Keshav.T, Matt).
So I'd like to play too :-D and my answer is "it's not ordered" (with Diwakar Aggarwal, Keshav.T, Matt).
now 3-4
My advice is: always trust the SAP documentation when it's said explicitly (I'm aware that the arguments or context are sometimes missing, so a confirmation is then needed).
You'll find it also in the wikipedia for SQL article (http://en.wikipedia.org/wiki/SQL#Queries): "The ORDER BY clause identifies which columns are used to sort the resulting data, and in which direction they should be sorted (options are ascending or descending). Without an ORDER BY clause, the order of rows returned by an SQL query is undefined."
Oracle SQL Reference, in the Query Optimizer section (http://download.oracle.com/docs/cd/B14117_01/server.101/b10752/optimops.htm#35891) : "If data must be sorted by order, then use the ORDER BY clause, and do not rely on an index. If an index can be used to satisfy an ORDER BY clause, then the optimizer uses this option and avoids a sort."
In fact, this is logic when we know how RDBMS are built, all this is about the selection of the access path to get the data (that we see with the explain plan, the path depends especially on what the database contains, that is different between test and production), the faster way to do things (an ordering is not always required, so why the RDBMS would spend time to organize it)
Don't we have this question in the Forum's FAQ by the way?
Sandra -
hi,
the select statment is
SELECT SINGLE * FROM edidc WHERE docnum = l_docnum AND direct = '1' AND status = '3' AND mestyp = 'OILSHL'.
there is an entry in the table edidc for the mentioned conditions.
but it is returning sy-subrc = 4.
please check what is the wrong in the statement and provide me the solution for that.
it is very urgent......
thanks in advance....<b>please use the below program for getting it</b> ....
REPORT ZTES_12 .
TABLES : edidc .
SELECT-OPTIONS : l_docnum FOR edidc-docnum .
DATA : ITAB TYPE TABLE OF edidc ,
ITAB_WA LIKE edidc .
SELECT * FROM edidc INTO TABLE ITAB WHERE docnum IN l_docnum AND
direct = '1'
AND status = '29' AND mestyp = 'MATQM'.
LOOP AT ITAB INTO ITAB_WA .
WRITE / : ITAB_WA-docnum .
ENDLOOP.
reward points if it is usefull .....
Girish -
Which system field returns the number of records returned after a select?
Which system field returns the number of records returned after a select?
a) sy-index
b) sy-recno
c) sy-lncnt
d) sy-dbcnt
e) sy-tabixHi,
SY-DBCNT
Regards,
Prashant -
Performace problem in a select statment how to imporve the performance
fist select statment
SELECT a~extno
a~guid_lclic " for next select
e~ctsim
e~ctsex
*revised spec 3rd
f~guid_pobj
f~amnt_flt
f~amcur
f~guid_mobj
e~srvll "pk
e~ctsty "PK
e~lgreg "PK
INTO TABLE gt_sagmeld
FROM /SAPSLL/LCLIC as a
INNER JOIN /sapsll/tlegsv as e on elgreg = algreg
* revised spec 3rd
inner join /sapsll/legcon as f on fguid_lclic = aguid_lclic " for ccngn1 selection
inner join /sapsll/corcts as g on gguid_pobj = fguid_pobj
where a~extno in s_extno.
sort gt_sagmeld by guid_lclic guid_pobj.
lgreg ctsty srvll
delete adjacent duplicates from gt_sagmeld comparing guid_lclic guid_pobj.
it selects about 20 lakh records
belos select statment whichs is taking time as it is based on the entreis of gt_sagmeld
select /sapsll/corpar~guid_mobj
/sapsll/corpar~PAFCT
but000~bpext
but000~partner
/sapsll/corpar~parno
into table gt_but001
from /sapsll/corpar
INNER join but000 on but000partner = /sapsll/corparparno
for all entries in gt_sagmeld
where /sapsll/corpar~guid_mobj = gt_sagmeld-guid_mobj
and /sapsll/corpar~PAFCT = 'SH'.
SELECT /sapsll/cuit~guid_cuit " PK
/sapsll/cuit~QUANT_FLT " to be displayed
/sapsll/cuit~QUAUM " to be displayed
/sapsll/cuit~RPTDT " to be displayed
/sapsll/cuhd~guid_cuhd " next select
/sapsll/cuit~guid_pr " next select
INTO table gt_sapsllcuit
FROM /sapsll/cuit
inner join /sapsll/cuhd on /sapsll/cuitguid_cuhd = /sapsll/cuhdguid_cuhd
FOR all entries in gt_sagmeld
WHERE /sapsll/cuit~guid_cuit = gt_sagmeld-guid_pobj.
Delete adjacent duplicates from gt_sapsllcuit[].
if not gt_sapsllcuit[] is initial.hi navenet
that didnt worked
we need to try ur range options
but not sure what you told in the last mail as not clear with range can u pls eloboragte more i am pasting the full code here
SELECT a~extno
a~guid_lclic " for next select but000
e~ctsim
e~ctsex
e~srvll
e~ctsty
e~lgreg
INTO TABLE gt_sagmeld
FROM /SAPSLL/LCLIC as a
INNER JOIN /sapsll/tlegsv as e on elgreg = algreg
where a~extno in s_extno.
sort gt_sagmeld by guid_lclic.
delete adjacent duplicates from gt_sagmeld comparing all fields.
IF not gt_sagmeld[] is initial.
SELECT /sapsll/legcon~guid_lclic
/sapsll/legcon~guid_pobj
/sapsll/legcon~amnt_flt
/sapsll/legcon~amcur
but000~bpext
*revised spec
/sapsll/corpar~PAFCT
/sapsll/legcon~guid_mobj
/sapsll/cuit~guid_cuit
INTO TABLE gt_but000
FROM /SAPSLL/LEGCON
for all entries in gt_sagmeld
where /SAPSLL/legcon~guid_lclic = gt_sagmeld-guid_lclic.
IF NOT GT_BUT000[] IS INITIAL.
sort gt_but000 by guid_mobj.
delete adjacent duplicates from gt_but000 comparing guid_mobj.
select /sapsll/corpar~guid_mobj
/sapsll/corpar~PAFCT
/sapsll/corpar~parno
into table gt_but001
from /sapsll/corpar
for all entries in gt_but000
where /sapsll/corpar~guid_mobj = gt_but000-guid_mobj.
and /sapsll/corpar~PAFCT = 'SH'.
DELETE gt_but001 where PAFCT <> 'SH'.
*sort gt_corpar by parno.
*delete adjacent duplicates from gt_corpar comparing parno.
*select gd000~partner
gd000~bpext
from gd000 into table gt_but001
for all entries in gt_corpar
where gd000~partner = gt_corpar-parno.
my ultimat aim is to select bpext from gd000
can u please explain how to use ranges here and what is the singnificance and how ill i read the data from the final table if we use ranges
regards
Nishant -
Sequence mySequence = myEngine.NewSequence();
mySequence.Name = "myAction";
//Create new step of type Action and set Name
Step mystep = myEngine.NewStep(AdapterKeyNames.DotNetAdapterKeyname, StepTypes.StepType_Action);
mystep.Name = "GetStringObject";
//Obtain the code module from the step
DotNetModule myModule = mystep.Module as DotNetModule;
//Set properties of the module
myModule.SetAssembly(DotNetModuleAssemblyLocations.DotNetModule_AssemblyLocation_File, @"C:\Documents and Settings\My Documents\Visual Studio 2005\Projects\HelperClass\HelperClass\bin\Debug\HelperClass.dll");
myModule.ClassName = "Class1";
myModule.MemberType = DotNetModuleMemberTypes.DotNetMember_GetProperty;
myModule.MemberName = "StringObject";
mySequence.InsertStep(mystep, 0, StepGroups.StepGroup_Setup);
mySequence.Locals.NewSubProperty("StringObject", PropertyValueTypes.PropValType_Reference, false, "", 0);
DotNetParameterDirections reference = mySequence.Locals as DotNetParameterDirections;
mySequence.Locals.GetPropertyObject("StringObject", 0);
myModule.ClassReference = "Locals.StringObject";
myModule.LoadPrototypeFromMetadataToken(385875969, 0);
After this I am not able to proceed.herewith attached documents contain screenshot of teststand file marked red is to be solved. How to define the value field of the return parameters?
Attachments:
HelperClass.cs 1 KB
ex1.gif 2305 KBPlease see my answer to your question on page two of the following forum thread:
Programmatically generating DotNet Steps in TestStand
Manooch H.
National Instruments -
How can I limit the number of rows returned by a select stat
How can I limit the number of rows returned by a select
statement. I have a query where I return the number of stores
that are located in a given area.. I only want to return the
first twenty-five stores. In some instances there may be over
200 stores in a given location.
I know is SQL 7 that I can set the pagesize to be 25....
Anything similiar in Oracle 8i?
nullDebbie (guest) wrote:
: Chad Nale (guest) wrote:
: : How can I limit the number of rows returned by a select
: : statement. I have a query where I return the number of
: stores
: : that are located in a given area.. I only want to return the
: : first twenty-five stores. In some instances there may be
: over
: : 200 stores in a given location.
: : I know is SQL 7 that I can set the pagesize to be 25....
: : Anything similiar in Oracle 8i?
: If you are in Sql*Plus, you could add the statement
: WHERE rownum <= 25
: Used together with an appropriate ORDER BY you
: could get the first 25 stores.
Watch out. ROWNUM is run before ORDER BY so this would only
order the 25 selected
null -
Error - "All JCo return parameters are initial"
Hi,
I got this error on my production XI server for about two hours and then everything started to work again. Does somebody have an idea of what could be the cause of this error?
(All JCo return parameters are initial)
Rgds,
YvesThanks for your response, I will check with SAP. This is not acceptable! There are lots of traffic in our R/3 world between QAT and PRD. I cannot just stop the messages (XI to PRD) when it's happening. This is really strange. I'm sure there is a way to fix this. I will get back to you when I will find the way.
Thanks
Yves -
All JCo return parameters are initial
Hi,
I'm getting "All JCo return parameters are initial" on a SOAP->XI->R/3 scenario. What could be the cause? This is not all the time, it's working 99.5% of the time!
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <!-- Request Message Mapping
-->
- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
<SAP:Category>XIServer</SAP:Category>
<SAP:Code area="MAPPING">INITIAL_JCO_RETURN</SAP:Code>
<SAP:P1 />
<SAP:P2 />
<SAP:P3 />
<SAP:P4 />
<SAP:AdditionalText />
<SAP:ApplicationFaultMessage namespace="" />
<SAP:Stack>All JCo return parameters are initial</SAP:Stack>
<SAP:Retry>N</SAP:Retry>
</SAP:Error>
Rgds,
YvesThanks for your response, I will check with SAP. This is not acceptable! There are lots of traffic in our R/3 world between QAT and PRD. I cannot just stop the messages (XI to PRD) when it's happening. This is really strange. I'm sure there is a way to fix this. I will get back to you when I will find the way.
Thanks
Yves -
Multi-Value return on the selection screen.
hi everyone,
I have two parameters on selection screen, Material Number and Material Description. I have provided custom F4 help for Material Number and the Material Description Field is input disabled. On selecting one of the values for Matnr from F4 help, it should auto populate Material Description without pressing enter or F8.
How to achieve this?Hi,
For this you need to create a Search help that EXPORTS these two values.
And then Create a strcutre which will have these two fields, and in SE11 you should assign your search help to on of the fields and MAP your search help EXPORT parameters to your Structure fields.
After doing this use this strcutre to create your selection-screen fields.
PARAMETER: fld1 like struct-fld1,
fld2 like struct-fld2.
Here struct is the structure that you create and where you assign your search help to structure.
Regards,
Sesh
Maybe you are looking for
-
Goods Issue Configuration - Account 330001 already used in transaction BSX
Dear All Experts, I am configuring OBYC for Goods Issue scnario. When I am putting Stock account and this error I am getting Account 330001 already used in transaction BSX Message no. F4803 Diagnosis Accounts used in transaction BSX (posting to asse
-
Hi everyone, While I execute exchange provisioning process, an arror occured : *2012-10-08T14:52:38.227+03:00] [oim_server1] [ERROR] [] [ORACLE.IAM.CONNECTORS.ICFCOMMON.PROV.ICPROVISIONINGMANAGER] [tid: [ACTIVE].ExecuteThread: '1' for queue: 'weblogi
-
Since installing mountain lion system keeps shutting down and restarting
since i installed the latest operating system my iMac unexpectedly shuts down and restarts. this never happened prior to the install. anyone having similar problems?
-
Problems with N91(GSM) multimedia/music key
the multimedia key pressing which can be entered directly to the NOW PLAYING option of the music player is not working properly in my set.whenever i press that key a message is shown on the screen..."ITEM NO LONGER AVAILABLE.RESTORING DEFAULT MULTIME
-
Right now I have only Firefox open with 4 tabs. Firefox only has 1 extension (1Password). No other application open or running (that I know of). My dock has 17 icons (including basics like trash, finder, launch, etc). As mentioned I have a: 2.8 GHz I