Adding a CM: Invalid length parameter passed to the RIGHT function. (CINF)
We started seeing this error message a week ago when attempting to add a Credit Memo. We only see this error message when entering Credit Memos and not any other finacial documents. I've done some preliminary research and haven't really come up with anything to point to the issue. Prior to reporting this to my support partner, I wanted to see if anybody here has seen this before or give me some ideas to look into the source of the issue.
Full error message: Microsoft SQL Native Client SQL Server Invalid length parameter passed to the RIGHT function. (CINF)
Checking the list of form ID's at [http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/892] shows the A/R Credit Memo as 179 and the A/P Credit Memo as 181. This also corresponds with what I see when viewing the system information on the form.
Similar Messages
-
Invalid length parameter passed to the LEFT or SUBSTRING function.
Below code is returning me invalid length (or) parameter.
Msg 537, Level 16, State 2, Line 2
Invalid length parameter passed to the LEFT or SUBSTRING function.
, ( select Top 1 person_id from person_membership where status_flag='A' and membership_id = a.membership_id and person_id in (select person_id from person where first_name =SUBSTRING(a.firstname, 1, CHARINDEX(' ', a.firstname) - 1) and surname = REVERSE(SUBSTRING(REVERSE(a.firstname), 1, CHARINDEX(' ', REVERSE(a.firstname)) - 1)) ))as Person_ID
,(select rtrim(ltrim(isNull(address_line1,''))) + ' ' + rtrim(ltrim(isNull(address_line2,''))) + ' ' + rtrim(ltrim(isNull(address_line3,'')))
+ ' ' + rtrim(ltrim(isNUll(suburb,''))) + ' ' + rtrim(ltrim(isNUll(state,''))) + ' ' + rtrim(ltrim(isNUll(convert(char(10),postcode),'')))
from address where address_type= 'P' and person_id = ( select Top 1 person_id from person_membership where status_flag='A' and membership_id = a.membership_id and person_id in (select person_id from person where first_name =SUBSTRING(a.firstname, 1, CHARINDEX(' ', a.firstname) - 1) and surname = REVERSE(SUBSTRING(REVERSE(a.firstname), 1, CHARINDEX(' ', REVERSE(a.firstname)) - 1)) ))
)as Person_Postal_Address
,(select rtrim(ltrim(isNull(address_line1,''))) + ' ' + rtrim(ltrim(isNull(address_line2,''))) + ' ' + rtrim(ltrim(isNull(address_line3,'')))
+ ' ' + rtrim(ltrim(isNUll(suburb,''))) + ' ' + rtrim(ltrim(isNUll(state,''))) + ' ' + rtrim(ltrim(isNUll(convert(char(10),postcode),'')))
from address where address_type= 'H' and person_id = ( select Top 1 person_id from person_membership where status_flag='A' and membership_id = a.membership_id and person_id in (select person_id from person where first_name =SUBSTRING(a.firstname, 1, CHARINDEX(' ', a.firstname) - 1) and surname = REVERSE(SUBSTRING(REVERSE(a.firstname), 1, CHARINDEX(' ', REVERSE(a.firstname)) - 1)) ))
)as Person_Home_Address
,(SELECT contact.contact_detail FROM contact WHERE contact.contact_type = 'H' AND contact.person_id = d.person_id AND
contact.contact_id = (SELECT max(dbo.contact.contact_id) FROM dbo.contact WHERE dbo.contact.contact_type = 'H'
and dbo.contact.person_id = (select Top 1 person_id from person_membership where status_flag='A'
and membership_id = a.membership_id and person_id in (select person_id from person where first_name =SUBSTRING(a.firstname, 1, CHARINDEX(' ', a.firstname) - 1) and surname = REVERSE(SUBSTRING(REVERSE(a.firstname), 1, CHARINDEX(' ', REVERSE(a.firstname)) - 1)) ) ) )
) as Person_Home
,(SELECT contact.contact_detail FROM contact WHERE contact.contact_type = 'W' AND contact.person_id = d.person_id AND
contact.contact_id = (SELECT max(dbo.contact.contact_id) FROM dbo.contact WHERE dbo.contact.contact_type = 'W'
and dbo.contact.person_id = (select Top 1 person_id from person_membership where status_flag='A'
and membership_id = a.membership_id and person_id in (select person_id from person
where first_name =SUBSTRING(a.firstname, 1, CHARINDEX(' ', a.firstname) - 1) and surname = REVERSE(SUBSTRING(REVERSE(a.firstname), 1, CHARINDEX(' ', REVERSE(a.firstname)) - 1)))))
) as Person_Work_Phone
-kccrga http://dbatrend.blogspot.com.au/I have fixed the query by applying the below solution
, ( select Top 1 person_id from person_membership where status_flag='A' and membership_id = a.membership_id and person_id in (select person_id from person
where first_name =SUBSTRING(a.firstname, NULLIF(CHARINDEX(' ',a.firstname),0)+1, CHARINDEX(' ', a.firstname) + 1)
and surname = REVERSE(SUBSTRING(REVERSE(a.firstname),NULLIF(CHARINDEX(' ',a.firstname),0)+1, LEN(a.firstname)- CHARINDEX(' ', REVERSE(a.firstname)) + 1)) ))as Person_ID
,(select rtrim(ltrim(isNull(address_line1,''))) + ' ' + rtrim(ltrim(isNull(address_line2,''))) + ' ' + rtrim(ltrim(isNull(address_line3,'')))
+ ' ' + rtrim(ltrim(isNUll(suburb,''))) + ' ' + rtrim(ltrim(isNUll(state,''))) + ' ' + rtrim(ltrim(isNUll(convert(char(10),postcode),'')))
from address where address_type= 'P' and person_id = ( select Top 1 person_id from person_membership where status_flag='A' and membership_id = a.membership_id
and person_id in (select person_id from person where first_name =SUBSTRING(a.firstname, NULLIF(CHARINDEX(' ',a.firstname),0)+1,LEN(a.firstname)- CHARINDEX(' ', a.firstname) + 1)
and surname = REVERSE(SUBSTRING(REVERSE(a.firstname),NULLIF(CHARINDEX(' ',a.firstname),0)+1, LEN(a.firstname)- CHARINDEX(' ', REVERSE(a.firstname)) + 1)) ))
)as Person_Postal_Address
,(select rtrim(ltrim(isNull(address_line1,''))) + ' ' + rtrim(ltrim(isNull(address_line2,''))) + ' ' + rtrim(ltrim(isNull(address_line3,'')))
+ ' ' + rtrim(ltrim(isNUll(suburb,''))) + ' ' + rtrim(ltrim(isNUll(state,''))) + ' ' + rtrim(ltrim(isNUll(convert(char(10),postcode),'')))
from address where address_type= 'H' and person_id = ( select Top 1 person_id from person_membership where status_flag='A'
and membership_id = a.membership_id and person_id in (select person_id from person
where first_name =SUBSTRING(a.firstname, NULLIF(CHARINDEX(' ',a.firstname),0)+1, LEN(a.firstname)-CHARINDEX(' ', a.firstname) + 1)
and surname = REVERSE(SUBSTRING(REVERSE(a.firstname),NULLIF(CHARINDEX(' ',a.firstname),0)+1, LEN(a.firstname)- CHARINDEX(' ', REVERSE(a.firstname)) + 1)) ))
)as Person_Home_Address
,(SELECT contact.contact_detail FROM contact WHERE contact.contact_type = 'H' AND contact.person_id = d.person_id AND
contact.contact_id = (SELECT max(dbo.contact.contact_id) FROM dbo.contact WHERE dbo.contact.contact_type = 'H'
and dbo.contact.person_id = (select Top 1 person_id from person_membership where status_flag='A' and membership_id = a.membership_id
and person_id in (select person_id from person where first_name
=SUBSTRING(a.firstname, NULLIF(CHARINDEX(' ',a.firstname),0)+1, LEN(a.firstname)-CHARINDEX(' ', a.firstname) + 1)
and surname = REVERSE(SUBSTRING(REVERSE(a.firstname),NULLIF(CHARINDEX(' ',a.firstname),0)+1, LEN(a.firstname)- CHARINDEX(' ', REVERSE(a.firstname)) + 1)) ) ) )
) as Person_Home_Phone
,(SELECT contact.contact_detail FROM contact WHERE contact.contact_type = 'W' AND contact.person_id = d.person_id AND
contact.contact_id = (SELECT max(dbo.contact.contact_id) FROM dbo.contact WHERE dbo.contact.contact_type = 'W' and dbo.contact.person_id = (select Top 1 person_id from person_membership where status_flag='A'
and membership_id = a.membership_id and person_id in (select person_id from person where first_name
=SUBSTRING(a.firstname, NULLIF(CHARINDEX(' ',a.firstname),0)+1, LEN(a.firstname)-CHARINDEX(' ', a.firstname) + 1)
and surname = REVERSE(SUBSTRING(REVERSE(a.firstname), NULLIF(CHARINDEX(' ',a.firstname),0)+1, LEN(a.firstname)-CHARINDEX(' ', REVERSE(a.firstname)) + 1)) ) ) )
) as Person_Work_Phone
-kccrga http://dbatrend.blogspot.com.au/ -
Invalid length parameter passed to the LEFT or SUBSTRING function, error on INSERT
I have a stored procedure that does a BULK INSERT of a csv file into myCSVTable then INSERTs records from
myCSVTable into myTable. The INSERT statement is giving me this error:
Invalid length parameter passed to the LEFT or SUBSTRING function.
CSV File:
3,020000007,OR,051,97205,02020005,41075,19470721,2,0,,0,0,0,0,0,1,0,0,,,,,,,,,0,2,,334418,334418,334418,13,,0,,0,0,0,0,0,1,0,0,1,20100217,,,,,20100304,20121030,1,1,,,0,0,0,0,0,,,,,0,0,0,0,9,0,0,0,1,1,0,0,0,3,00,20100304,20100426,20100922,20101011,20100304,20100922,20101011,,20101011,20100819,,20100326,20100326,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0,,,1,1,,9,9,1,1,1,1,0,0,111150,111150,111150,999999,5586.25,4714.01,5884.28,7055.89,11097.89,10839.39,0.00,2,,,,,20120617,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,The
Workforce Investment Board for the City of xxxxxxxx and xxxxxxxxx and W,020005,,mstr: 1000000000000000017 js: 372651 epi: 1,Jane Doe
4,020000007,OR,051,97205,02020005,41075,19470721,2,0,,0,0,0,0,0,1,0,0,,,,,,,,,0,2,,334418,334418,334418,13,,0,,0,0,0,0,0,1,0,0,1,20100217,,,,,20100304,20121030,1,1,,,0,0,0,0,0,,,,,0,0,0,0,9,0,0,0,1,1,0,0,0,3,00,20100304,20100426,20100922,20101011,20100304,20100922,20101011,,20101011,20100819,,20100326,20100326,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,0,,,1,1,,9,9,1,1,1,1,0,0,111150,111150,111150,999999,5586.25,4714.01,5884.28,7055.89,11097.89,10839.39,0.00,2,,,,,20120617,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,The
Workforce Investment Board for the City of xxxxxxxx and xxxxxxxxx and W,020005,,mstr: 1000000000000000017 id: 020000007 epi: 1,Jane Doe
There is no LEFT or SUBSTRING function used in the procedure and there are no triggers on either table.
The procedure had been working fine until today, when I altered one of the CSV fields. The code which triggers the error is this:
INSERT [myTable]
SELECT * FROM [myCSVTable]
The weird thing is, the 1st record containing the changed field (mstr: 1000000000000000017 js: 372651 epi: 1) triggers the error, but the 2nd record containing
the old field value (mstr: 1000000000000000017 id: 020000007 epi: 1), does not.
There are only blank spaces in the 2 strings, no non-printable characters or anything like that. I'm confused.A View of myTable was causing the problem.
Hi LoriCazares,
Do you mean that you have solved this issue? If so, please close this thread.
Regards,
Elvis Long
TechNet Community Support -
Getting error Invalid length parameter passed
Hi,
I'm getting an error running my query. It say "Invalid length parameter passed to the LEFT or SUBSTRING function. I will be getting the string in between of hyphen using the code below. May i ask your assistance or idea on how to fix this issue.
thank you.
Substring(ins.itemid,11,CHARINDEX('-',ins.itemid+'-',11)-11) AS MODEL
Msg 537, Level 16,
State 3, Line 1
Invalid length parameter passed to the LEFT or SUBSTRING
function.
Sample data of Itemid.
B300-4410-ONEMAX-U
B300-1725-XWHT-U
B300-3110-VT981-U
B300-1720-DRZRKCROBLK-U
B300-1720-DRDTHN32BLK-UThat'll cause empty strings to show up into you're result set but shouldn't cause the the SUBSTRING function to fail.
The error is the result of the SUBSTRING function trying to bring back a negative number of characters.
Try running the following and see what comes back...
SELECT ins.itemid
FROM dbo.TableName ins
WHERE LEN(ins.itemid) < 11
If you don't find any itemids what are less than 11 characters (I'm 99% sure you will), try using a little test script like the following to test suspect values...
IF OBJECT_ID('tempdb..#temp') IS NOT NULL
DROP TABLE #temp
GO
CREATE TABLE #temp (
itemid VARCHAR(30)
INSERT #temp (itemid) VALUES
('B300-4410-ONEMAX-U'),
('B300-1725- '),
('B300- 3110-VT981-U'),
('B300-1720-DRZRKCROBLK-U'),
('B300- 1720-DRDTHN32BLK-U')
SELECT ins.itemid
FROM #temp ins
WHERE LEN(ins.itemid) < 11
SELECT
SUBSTRING(
ins.itemid, 11, CHARINDEX('-',ins.itemid+'-',11)-11) AS MODEL FROM #temp ins
HTH,
Jason
Jason Long -
The 'argumentname' argument passed to the 'Methodename 'function is not of type 'Dto name'
Hi, there!
Sr for that question, because it should be pretty easy to answer, but i'm totally new to coldfusion
and googled for about an hour now. I have a orm DTO.cfc:
<cfcomponent entityname="testDTO" persistent="true" table="test" schema="informix" output="false">
<!---- properties ---->
</cfcomponent>
and have a service Methode in test.cfc
<!---- Add test---->
<cffunction name="createTest" returntype="testDTO" access="remote">
<cfargument name="item" type="testDTO" required="true" />
<!---- Auto-generated method
Insert a new record in test---->
<cfset entitysave(item) />
<!---- return created item ---->
<cfreturn item/>
</cffunction>
i try to call via the the <cfInvoke>-Tag
<cfset lieferant = entityNew('test')>
<cfinvoke
component="#request.componentbase#.test"
method="createTest"
item="#test#"
returnvariable="test">
but the error
'The ITEM argument passed to the createLieferant function is not of type testDTO.'
appears on function call. I just can't find a way to tell cf that lieferant is of type testDTO.
When i type the methodes parameter to struct the methode call works well.
Thanks for your help in advance!
FlorianI'm assuming your extract there isn't quite right:
<cfset lieferant = entityNew('test')>
<cfinvoke
component="#request.componentbase#.test"
method="createTest"
item="#test#"
returnvariable="test">
You're doing item="#test#", surely this should be item="#lieferant#"?
In which case, you've done <cfset lieferant = entityNew('test')>, which is of type "test", not "testDTO"?
If you're still having trouble, remove the item="" attribute from CFINVOKE and use CFINVOKEARGUMENTs instead. -
Report server parameter not calling the right url
Hi,
I installed a Oracle 10g application server on windows 2003 server. there were not customization being made yet.
I run my form, click to call a report and it shows the parameter form nicely.
at this point, the url shows http://www.mydomain.com:7777/reportbla-bla-bla
After selecting my parameters, i click submit and the system shows web page cannot display.
at this point, the url shows http://myserverpcname:7777/reportbla-bla-bla
Can someone please tell me what should I do to set for the report parameter to call the right url?
ThanksI found the solution already... the setting is to be done at httpd.conf file
-
How can I add a url parameter to choose the right database row to delete using php in Dreamweaver CC
Hi all,
I have just upgraded to Adobe Creative Cloup. Though I find it very good there was one flaw and that was the omision of the database section. I got this sorted but now I find that once I have set up the connection to the database and want to eithger delete or update records there is no 'url parameter' button to do so. Can someone advise we how to get round this.
Seasons Greatings from
David JThe link will look similar to
myPage.php?ID=myVariable -
how do i fix this
Sign in to the store using iTunes on your computer and check the payment details. Enter the correct security code for your credit card. If it still won't work, contact the card issuer and ask them what's wrong.
-
How to get each value from a parameter passed like this '(25,23,35,1)'
Hi
One of the parameter passed to the function is
FUNCTION f_main_facility(pi_flag_codes VARCHAR2) return gc_result_set AS
pi_flag_codes will be passed a value in this way '(25,23,35,1)'
How to get each value from the string
like 25 first time
23 second time
35 third time
1 fourth time
I need to build a select query with each value as shown below:-
(SELECT t2.org_id, t4.description
from org_name t2, ref_org_name t3, code_table t4
where t2.att_data = t4.code
and t3.ref_code = t2.att_type
and t2.att_type = 25 and t3.code_type = t4.code_type
and to_date('01-JAN-10', 'DD-MON-YY') between t2.att_start_date AND t2.att_end_date) q1,
(SELECT t2.org_id, t4.description
from org_name t2, ref_org_name t3,code_table t4
where t2.att_data = t4.code
and t3.ref_code = t2.att_type
and t2.att_type = 23 and t3.code_type = t4.code_type
and to_date('01-JAN-10', 'DD-MON-YY') between t2.att_start_date AND t2.att_end_date) q2,
(SELECT t2.org_id, RTRIM(xmlagg(xmlelement(e, t4.description || ';')
ORDER BY t4.description).EXTRACT('//text()'), ';') AS DESCRIPTION
from org_name t2, ref_org_name t3,code_table t4
where t2.att_data = t4.code
and t3.ref_code = t2.att_type
and t2.att_type = 35 and t3.code_type = t4.code_type
and to_date('01-JAN-10', 'DD-MON-YY') between t2.att_start_date AND t2.att_end_date
group by t2.org_id) q3,
(SELECT t2.org_id, t4.description
from org_name t2, ref_org_name t3, code_table t4
where t2.att_data = t4.code
and t3.ref_code = t2.att_type
and t2.att_type = 1 and t3.code_type = t4.code_type
and to_date('01-JAN-10', 'DD-MON-YY') between t2.att_start_date AND t2.att_end_date) q4
Please help me with extracting each alue from the parm '(25,23,35,1)' for the above purpose. Thank You.chris227 wrote:
I would propose the usage of regexp for readibiliy purposes and only in the case if this doesnt perform well, look at solutions using substr etc.
select
regexp_substr( '(25,23,35,1)', '\d+', 1, 1) s1
,regexp_substr( '(25,23,35,1)', '\d+', 1, 2) s2
,regexp_substr( '(25,23,35,1)', '\d+', 1, 3) s3
,regexp_substr( '(25,23,35,1)', '\d+', 1, 4) s4
from dual
S1 S2 S3 S4
"25" "23" "35" "1"In pl/sql you do something like l_val:= regexp_substr( '(25,23,35,1)', '\d+', 1, 1);
If t2.att_type is type of number you will do:
t2.att_type= to_number(regexp_substr( '(25,23,35,1)', '\d+', 1, 1))Edited by: chris227 on 01.03.2013 08:00Sir,
I am using oracle 10g.
In the process of getting each number from the parm '(25,23,35,1)' , I also need the position of the number
say 25 is at 1 position.
23 is at 2
35 is at 3
1 is at 4.
the reason I need that is when I build seperate select for each value, I need to add the query number at the end of the select query.
Please see the code I wrote for it, But the select query is having error:-
BEGIN
IF(pi_flag_codes IS NOT NULL) THEN
SELECT length(V_CNT) - length(replace(V_CNT,',','')) FROM+ ----> the compiler gives an error for this select query : PLS-00428:
*(SELECT '(25,23,35,1)' V_CNT FROM dual);*
DBMS_OUTPUT.PUT_LINE(V_CNT);
-- V_CNT := 3;
FOR L_CNT IN 0..V_CNT LOOP
if L_CNT=0 then
V_S_POS:=1;
V_E_POS:=instr(pi_flag_codes, ',', 1, 1)-1;
else
V_S_POS:=instr(pi_flag_codes,',',1,L_CNT)+1;
V_E_POS:=instr(pi_flag_codes, ',', 1, L_CNT+1)-V_S_POS;
end if;
if L_CNT=V_CNT then
V_ID:=TO_NUMBER(substr(pi_flag_codes,V_S_POS));
else
V_ID:=TO_NUMBER(substr(pi_flag_codes,V_S_POS,V_E_POS));
end if;
VN_ATYPE := ' t2.att_type = ' || V_ID;
rec_count := rec_count +1;
query_no := 'Q' || rec_count;
Pls help me with fetching each value to build the where cond of the select query along with the query number.
Thank You. -
Parameter passing problem to standard JSP iView
Hi,
I'm trying to launch a standard iView with some a parameter directly from the browser by calling the url http://<server>/<iview>?<param>=<value>
The iView ID is com.sap.pct.hcm.ecmmain.approval and by looking at its details from the content catalog I saw there was a property called CREVI. I would like to fill this in but the iview doesn't respond to the URL params at all. Setting them staticly by editing the iView works perfect.
I have also checked that the "Parameters to pass from Page Request" property includes * and excludes some other properties than the one I'm testing.
I thought this was going to be simple but can't just make it work..I guess I'm missing something basic or the property can't be used? Any ideas?
Thanks,
MikkoHi Mikko,
We have found inconsistencies with regards to parameter passing in the URL, sometimes they are read and sometimes not. I suggest that you try to change the order of the parameters as this can affect if its read. I also believe other parameters can interfere whether or not it is read so try various scenarios.
Cheers,
John -
Parameter Passing from UWL to WebDynpro Component
Hi Everyone,
I m having a small problem in parameter passing from the UWL to the Webdynpro component(EP6 SP16).
The UWL shows a list of shopping carts and I ve configured it such that the Shopping carts open in the webdynpro application. Now the requirement is that I want to pass the shopping cart number from the workitem container and retrieve it in the webdynpro component.
The only thing that i m able to retrieve is the work-item ID. I ve followed the documentation on help.sap.com but I m not able to figure out how to move ahead with this.The code which i m using to retrive the dynamic parameter is
String text = WDWebContextAdapter.getWebContextAdapter().getRequestParameter("DynamicParameter");
Can somebody please help me with this..
Regards,
PrathameshHave you looked at this weblog by Ginger Gatling?
Create new UI's for existing workflow tasks with ABAP Web Dynpro and Universal Worklist!
Hope this helps.
Sudha -
Parameter passing from master to subreport
Is it possible to pass a multi-value parameter from a master report to one or more subreports? If so, how?
Thanks for any help.
Wayne E. PfefferYes you can do this. I suggest the following: In your subreport make the report parameter a multi-value parameter. Test the subreport stand alone and make sure it works. Then drop the subreport into your main report, and map the subreport parameters to the main report parameters.
Scenario 1 (multi value parameter pass through):
The Main report has report parameter A which is a multi value parameter. You want to pass it to SubReport1 which has a report parameter B which is also defined as multi value parameter. In this case the mapping is just a simple parameter expression: =Parameters!A.Value
The subreport RDL element would look like this:
<Subreport Name="SubReport1">
<Parameters>
<Parameter Name="B">
<Value>=Parameters!A.Value</Value>
</Parameter>
</Parameters>
</Subreport>
Scenario 2:
The Main report has no report parameters. You have a SubReport1 with a report parameter B defined as multi value parameter. You want to pass e.g. three selected values "A", "B", "C" as parameter values to the subreport. You need to create a multidimensional object array on-the-fly, e.g. with the Split function, e.g.: =Split("A,B,C", ",")
RDL example:
<Subreport Name="SubReport1">
<Parameters>
<Parameter Name="B">
<Value>=Split("A,B,C", ",")</Value>
</Parameter>
</Parameters>
</Subreport>
Scenario 3:
The Main report has a multi-value parameter A. You want to pass only the first selected value from the main report's parameter to the subreport and the subreport's report parameter B is a single-value parameter. You can do this by using e.g. =Parameters!A.Value(0)
RDL example:
<Subreport Name="SubReport1">
<Parameters>
<Parameter Name="B">
<Value>=Parameters!A.Value(0)</Value>
</Parameter>
</Parameters>
</Subreport>
-- Robert -
What kind of input parameter is used in SUM function?
Hi Everyone,
As we know sum is a predefined oracle function. But what these oracle guys have used for the input parameters. How they have done this?
I mean we can write this sum fuction like so many ways like as mentioned below. Please give me some ideas how to do that.
SELECT SUM(salary) as "Total Salary" FROM employees;
SELECT SUM(DISTINCT salary) as "Total Salary" FROM employees;
SELECT SUM(income - expenses) as "Net Income" FROM gl_transactions;
SELECT SUM(sales * 0.10) as "Commission" FROM order_details;Regards,
BS2012BS2012 wrote:
Hi Everyone,
As we know sum is a predefined oracle function. But what these oracle guys have used for the input parameters. How they have done this?
I mean we can write this sum fuction like so many ways like as mentioned below. Please give me some ideas how to do that.
SELECT SUM(salary) as "Total Salary" FROM employees;
SELECT SUM(DISTINCT salary) as "Total Salary" FROM employees;
SELECT SUM(income - expenses) as "Net Income" FROM gl_transactions;
SELECT SUM(sales * 0.10) as "Commission" FROM order_details;Regards,
BS2012As others have said, your question is not quite clear.
There are many aspects and angles to looking at what you are asking.
Primarily, from a top-level, the sum function simply takes a number value as it's argument, so all those examples you have given have expressions in them that evaluate to a numeric value before being supplied to the sum function. (As someone else already mentioned you can have non-numeric datatypes, just so long as they can implicitly be converted to a numeric value).
From a statement parsing and execution perspective, the contents of the expression inside the brackets will be evaluated before being passed to the sum function. It is not the sum function that itself takes the expression and evaluates it. The sum function just expects a single numeric value.
Internally, what the sum function does, is more than just a single... call function and return value, because it has to deal with multiple values being passed in as part of the aggregating group. As such, it needs to have the ability to know when to start it's summing, to accept multiple values as input so it can sum them together, and to know when to stop summing inputs and pass the result back.
If we write our own user defined aggregate function (other people have already provided a link to explain such) we can see what is happening internally. In this following example, we'll write a user defined function that multiplies the values rather than sums them...
create or replace type mul_type as object(
val number,
static function ODCIAggregateInitialize(sctx in out mul_type) return number,
member function ODCIAggregateIterate(self in out mul_type, value in number) return number,
member function ODCIAggregateTerminate(self in mul_type, returnvalue out number, flags in number) return number,
member function ODCIAggregateMerge(self in out mul_type, ctx2 in mul_type) return number
create or replace type body mul_type is
static function ODCIAggregateInitialize(sctx in out mul_type) return number is
begin
sctx := mul_type(null);
return ODCIConst.Success;
end;
member function ODCIAggregateIterate(self in out mul_type, value in number) return number is
begin
self.val := nvl(self.val,1) * value;
return ODCIConst.Success;
end;
member function ODCIAggregateTerminate(self in mul_type, returnvalue out number, flags in number) return number is
begin
returnValue := self.val;
return ODCIConst.Success;
end;
member function ODCIAggregateMerge(self in out mul_type, ctx2 in mul_type) return number is
begin
self.val := self.val * ctx2.val;
return ODCIConst.Success;
end;
end;
create or replace function mul(input number) return number deterministic parallel_enable aggregate using mul_type;
/So, our user defined aggregate function is based on an aggregate object type.
This object holds a value ("val" in our example).
It has an Initialize method, so when the SQL engine indicates that it's the start of an aggregation of values it can set it's value to an initial value (in this case null).
It has an Iterate method, so as the SQL engine passes values to it as part of the aggregated set of values, it can process them (in our case it multiplies the input value with the value it already has for this set of aggregations (and takes a base value of 1 for the first iteration))
It has a Terminate method, so when the SQL engine indicates that the aggregate set of values is complete, it can return the result.
The last method in there is a Merge and is a mandatory requirement, so that when aggregation is done using parallel evaluation (to improve performance internally), the results of those parallelly executed aggregations can be combined together (see http://docs.oracle.com/cd/E11882_01/appdev.112/e10765/ext_agg_ref.htm#ADDCI5132). As we're multiplying numbers, in our case, it is simply a case of multiplying one result with the other.
And to see it working...
SQL> with t as (select 2 as x from dual union all
2 select 3 from dual union all
3 select 4 from dual union all
4 select 5 from dual)
5 --
6 select mul(x)
7 from t;
MUL(X)
120 -
Dashboard refresh - ORA-24373 invalid length specified for statement
Post Author: Reesy
CA Forum: Performance Management and Dashboards
I am getting the following error message in the log file "ORA-24373: invalid length specified for statement" when trying to refresh a metric via dashboard manager. The metric has been successfully refreshed previously. The only change that I am aware of is that more data has been added to the underlying database (Oracle 10g).
There are a number of different filters on the metric - some work ok - some give the above error.
Can anyone help?
CheersIWOULDFORMATMYCODESOITISREADABLEUSINGMIXEDCASESPACESANDNEWLINES.
ATABLEALIASWOULDPROBABLYHELPTOO. -
Invalid Evaluation Parameter in line 0. SPecified Depreciation Area
Hi! Im using SBO 8.8 PL 11
Upon adding new fixed asset master data, im encountering the error "Invalid Evaluation Parameter in line 0. SPecified Depreciation Area"...
Also, the selection list of the existing masterdata is available. However, after i chose an item, no item is retrieved in hte fixed asset masterdata form.
Help. What do i need to check or do??
CamilleHi,
From previous reported issues on this, our experience is that the cause of this issue is the version of SQL server.
Referring to B1 8.8 install CD\Documentation\SystemSetup\ AdministratorGuide_SQL.pdf, you will find the following part:
To properly use the SAP Business One Fixed Assets add-on on Microsoft SQL Server 2005, make sure that you have Microsoft SQL Server 2005 SP3 installed.
Upgrade MS SQL Server to SP3(build 9.0.4035), or SQL Server 2008(build 10.0.1600), the fixed assets should be working.
Let us know if this helps,
Jesper
Maybe you are looking for
-
Hello, First off, I am an amateur programmer. I have been programming for a few years now, but because I'm a meteorology major, and not a CSCI major, I haven't had too much time. Tying in the fields of meteorology and computer science, I have made a
-
My eprinter will not print in proper clolour even after new ink cartridges install cleaned nossles p
my eprinter will not print in proper in colour even after new ink cartridges installed cleaned nossles as new cartridges still not printing properly This question was solved. View Solution.
-
I paid for songs that are missing from my list where are they?
i paid for songs that are missing from my list where are they?
-
How to add domain name to SharePoint URL so SharePoint used FQDN address?
Hello, I have SharePoint sites with fully qualified domain name (FQDN). I have DNS and SharePoint configured to access sites with the FQDN links. I work in an organization with users who have logins in different domains, SharePoint servers are in di
-
AME CS5.5 freezes while encoding
I upgraded my iMac to OS X 10.9 (Mavericks) a couple weeks ago. I tried encoding a 30 minute 1080p video to H.264, VBR 1 pass and it freezes midway through the encoding process. It did this a few times and I never had this issue before upgrading the