How to store beyond the range value for a given data type!!!
Hi all,
I want to know.Is it possible to create a new data type like int,float in java. which can store any number without any range restrictions.As you know the range of byte data type is -128 - + 127.I don't want any range restrictions.The data type should be able to grow dynamically.
Regards!!
Tameshwar Sahu
The only solution I can think of is to use java objects, Im not sure youll be able to create a new primitive for java !!
Youd have to put together Integers, posibly in a vector depending on how HUGE a number youd like to create.
If you reached the max of one, add another to the vector. and then continue with the next.. The problem with this of course is the fact that math operations, will be a bit of a challenge to code. also actuall representation of the value would be a bit tricky as well !! There are however ways to go about this, you just have to think about it a little.
Similar Messages
-
C Programming: How can we get the filesystem name for a given file-path?
C Programming: How can we get the filesystem name for a given file-path?
Say I have a filepath=/mnt1/file1
Using some OS API like stat, can I get the Filesystem /mnt ?
Thanks in advance,
-VEnter the command up to the point of entering the file path and add a space, then drag the file into the terminal window. It will fill out the path.
If you need to go further into the contents of the Application package, you can continue with /Contents...
Another way is to start typing and then hit Tab to auto-complete. It will stop where it can't determine the next letter.
So, type /App tab and it will fill in /Applications. Type a / and start with the name of the app, then tab and it should complete. Continue till you have the correct path.
Spaces will be replaced with \<space>, so, App Store would end up as /Applications/App\ Store.app -
How to get the week number for a given date?
hi guys,
what is coding to get the week number for a given date?
For example, 1/1/05 is week 1. then 8/1/05 is week 2.The second parameter to pass to the method is supposed to be one of the month constants JANUARY - DECEMBER. It happens to be that their numerical values are 0-11, not 1-12, so your "12" refers to the "13th" month of the year.
givenDate = new GregorianCalendar(2003, Calendar.DECEMBER, 31);
If you want to construct dates and times from strings like you seem to be, look into SimpleDateFormat http://javaalmanac.com/egs/java.text/ParseTime.html
(even still I got WEEK_OF_YEAR as 1 which is true but not really what I expected, excuse my previous reply but I wanted to check the facts before posting this) -
A save request exceeded the quantity limits for a given structure type.
I am running PI7.1 SP6..
I have created all the objects and done all of the configuration in the Enterprise Service Builder and the Integration Builder and I am trying to publish the Webservice in the Service Registry, but after displaying the WSDL, and then publishing the Webservice, I get the following error:
com.sap.aii.ib.core.uddi.RegistryClientException: A save request exceeded the quantity limits for a given structure type.
Number of Business Entities exceeds your limit of 1 (2)
at com.sap.aii.ib.server.uddi.RegistryClientDelegateProvider$EjbRegistryClient.publishServices(RegistryClientDelegateProvider.java:338)
at com.sap.aii.ibdir.server.wsquery.WSQUDDISrvPublishTB.execute(WSQUDDISrvPublishTB.java:112)
at com.sap.aii.ibdir.core.simulation.DefaultTaskBroker.execute(DefaultTaskBroker.java:158)
at com.sap.aii.ibdir.server.simulation.TaskQueryService.specialQuery(TaskQueryService.java:31)
at com.sap.aii.ib.server.query.SpecialQueryServiceProvider$SpecialQueryServiceImpl.specialQuery(SpecialQueryServiceProvider.java:63)
at com.sap.aii.ib.server.query.QueryServiceImpl.specialQuery(QueryServiceImpl.java:443)
at com.sap.aii.ib.server.query.QueryServiceBean.specialQuery(QueryServiceBean.java:112)
at sun.reflect.GeneratedMethodAccessor534.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceedFinal(RequestInvocationContext.java:43)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:166)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatesTransition.invoke(Interceptors_StatesTransition.java:19)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Resource.invoke(Interceptors_Resource.java:71)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.doWorkWithAttribute(Interceptors_Transaction.java:38)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.invoke(Interceptors_Transaction.java:22)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:189)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatelessInstanceGetter.invoke(Interceptors_StatelessInstanceGetter.java:16)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_SecurityCheck.invoke(Interceptors_SecurityCheck.java:21)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_ExceptionTracer.invoke(Interceptors_ExceptionTracer.java:16)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.DefaultInvocationChainsManager.startChain(DefaultInvocationChainsManager.java:133)
at com.sap.engine.services.ejb3.runtime.impl.DefaultEJBProxyInvocationHandler.invoke(DefaultEJBProxyInvocationHandler.java:164)
at $Proxy2177.specialQuery(Unknown Source)
at sun.reflect.GeneratedMethodAccessor533.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sap.engine.services.rmi_p4.P4DynamicSkeleton.dispatch(P4DynamicSkeleton.java:234)
at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:351)
at com.sap.engine.services.rmi_p4.server.ServerDispatchImpl.run(ServerDispatchImpl.java:70)
at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:62)
at com.sap.engine.services.rmi_p4.P4Message.execute(P4Message.java:37)
at com.sap.engine.services.cross.fca.FCAConnectorImpl.executeRequest(FCAConnectorImpl.java:872)
at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:53)
at com.sap.engine.services.cross.fca.MessageReader.run(MessageReader.java:58)
at com.sap.engine.core.thread.execution.Executable.run(Executable.java:108)
at com.sap.engine.core.thread.execution.CentralExecutor$SingleThread.run(CentralExecutor.java:304)
Caused by: com.sap.esi.uddi.sr.api.ws.PublishServicesFault: A save request exceeded the quantity limits for a given structure type.
Number of Business Entities exceeds your limit of 1 (2)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at com.sap.engine.services.webservices.espbase.client.bindings.impl.JAXWSUtil.deserializeException(JAXWSUtil.java:357)
at com.sap.engine.services.webservices.espbase.client.bindings.impl.JAXWSUtil.processFault(JAXWSUtil.java:327)
at com.sap.engine.services.webservices.espbase.client.bindings.impl.SOAPTransportBinding.call_SOAP(SOAPTransportBinding.java:987)
at com.sap.engine.services.webservices.espbase.client.bindings.impl.SOAPTransportBinding.callWOLogging(SOAPTransportBinding.java:703)
at com.sap.engine.services.webservices.espbase.client.bindings.impl.SOAPTransportBinding.call(SOAPTransportBinding.java:673)
at com.sap.engine.services.webservices.espbase.client.jaxws.core.WSInvocationHandler.processTransportBindingCall(WSInvocationHandler.java:167)
at com.sap.engine.services.webservices.espbase.client.jaxws.core.WSInvocationHandler.invokeSEISyncMethod(WSInvocationHandler.java:120)
at com.sap.engine.services.webservices.espbase.client.jaxws.core.WSInvocationHandler.invokeSEIMethod(WSInvocationHandler.java:83)
at com.sap.engine.services.webservices.espbase.client.jaxws.core.WSInvocationHandler.invoke(WSInvocationHandler.java:64)
at $Proxy2689.publishServices(Unknown Source)
at com.sap.esi.uddi.sr.api.ws.ejb.ServicesRegistryProxyFacade.publishServices(ServicesRegistryProxyFacade.java:358)
at sun.reflect.GeneratedMethodAccessor1059.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceedFinal(RequestInvocationContext.java:43)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:166)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatesTransition.invoke(Interceptors_StatesTransition.java:19)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Resource.invoke(Interceptors_Resource.java:71)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.doWorkWithAttribute(Interceptors_Transaction.java:38)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.invoke(Interceptors_Transaction.java:22)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:189)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatelessInstanceGetter.invoke(Interceptors_StatelessInstanceGetter.java:16)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_SecurityCheck.invoke(Interceptors_SecurityCheck.java:21)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_ExceptionTracer.invoke(Interceptors_ExceptionTracer.java:16)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:177)
at com.sap.engine.services.ejb3.runtime.impl.DefaultInvocationChainsManager.startChain(DefaultInvocationChainsManager.java:133)
at com.sap.engine.services.ejb3.runtime.impl.DefaultEJBProxyInvocationHandler.invoke(DefaultEJBProxyInvocationHandler.java:164)
at $Proxy255.publishServices(Unknown Source)
at com.sap.aii.ib.server.uddi.RegistryClientDelegateProvider$EjbRegistryClient.publishServices(RegistryClientDelegateProvider.java:335)
... 41 more
As always, these errors are so informative!
It has published the Webservice in the Service Registry, but not with the End Points...
has anyone come across the message before and know how to fix it so I can successfully publish the Webservice???
I have searched SDN and OSS - also opened an OSS note about another error I am experiencing...Hi Barry
Have you already published for the same server or this is first time you tried and got error ?
Did you referred Troubleshooting guide
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e05829a5-55aa-2a10-f694-ba8e30c3c122
Master installation guide
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e0301486-758c-2a10-9d84-a195556df422
Thanks
Gaurav -
How to find out the ASCII Values for Spanish character
Hi,
I had an requirement to store Spanish character and also need to fileter the records based on the Spanish character.
Kindly guide me for below.
To filter the Records which contains spanish characters?
To get the ASCII Values for the particular column?
E.g. we can find out the ASCII value of 'a' by using the syntax select ASCII('a') from dual.
But I want to find the ASCII Values for the particular column value. Ie. name.
E.g., Client name is "Suresh", I want to the ASCII Values for entire name of "Suresh".
Kindly do the needful help / Guidance on this.
Thanks,
OraharTo expand on what I said in my first post, you want to do something along these lines:
with t (thename) as
select 'Suresh' from dual
select thename
, substr(TheName, level, 1)
, ascii(substr(thename, level))
from t
connect by level <= length(thename);The output of the above query is:
THENAM S ASCII(SUBSTR(THENAME,LEVEL))
Suresh S 83
Suresh u 117
Suresh r 114
Suresh e 101
Suresh s 115
Suresh h 104
6 rows selected.Note that the WITH statement is only there to simulate a table for this example. With a table, all you do is get rid of the with and substitute the name "t" for the name of your table (also the name of the column to whatever name the column has in your table).
Lastly, I suggest you post your question along with, an example table and the output you'd like to get in the PL/SQL forum. There are people there that will give you all kinds of great ways of solving that problem.
HTH,
John. -
How to query a item stock quantity for a given date
Hi there,
I need to query the stock quantity of an item for a given date. For example, i want to know how many pieces of A i have on stock at the 20th of march 2009.
I know there is a report, but i need the value for a subquery.
Regards SteffenSorry Gordon,
Your query is not wrong, far from me to insult your work. It does indeed make full sense if the business process allows the item description to change.
If not, we can avoid a "inner join" = smaller, cleaner and (theoritically) faster query
Here is your code with the little review:
SELECT T0.ItemCode, T0.Dscription, sum(T0.InQty - T0.OutQty) as 'On Hand'
FROM DBO.OINM T0
WHERE T0.DocDate <= '[%0]' and T0.ItemCode = '[%1]'
GROUP BY T0.ItemCode, T0.Dscription
Cheers
tested on 2007 SP00 PL46 -
Selecting last value for a given date
I've read some of the other threads on the this tope, but can't find a resolution.
My query is supposed to get the last values for the given two days (start date and end date) and I return the difference between the two values. The query as it is only works for days where there is an entry for 12:00 pm. On some days, it will therefore return nothing. But I'm not sure how to get it to choose the last value for the given day and still remain a fast query.
Here is a sample of the query with dates that return a result.
SELECT max_query.sgnl_id as sgnl, max_query.max_val - min_query.min_val result_val
FROM
(SELECT t1.sgnl_id, t2.smpl_dte, t1.pv_id,
MAX(t2.integ_since_val) AS max_val
FROM diag.blm_acct t2, diag.pv_sgnl_id_assc t1
WHERE t2.smpl_dte = TO_DATE ('11/15/2008 12:00:00 PM', 'MM-DD-YYYY HH:MI:SS AM')
AND t1.pv_id = t2.pv_id
AND t2.pv_id IN
(SELECT pv_id
FROM diag.pv_sgnl_id_assc
WHERE sgnl_id IN
(SELECT sgnl_id
FROM diag.series_sgnl_rec_asgn
WHERE series_id = 'Series5'
GROUP BY t1.sgnl_id, t2.smpl_dte, t1.pv_id
) max_query ,
(SELECT pv_id,
MAX(integ_since_val) AS min_val
FROM diag.blm_acct
WHERE smpl_dte = TO_DATE ('11/10/2008 12:00:00 PM', 'MM-DD-YYYY HH:MI:SS AM')
AND pv_id IN
(SELECT pv_id
FROM diag.pv_sgnl_id_assc
WHERE sgnl_id IN
(SELECT sgnl_id
FROM diag.series_sgnl_rec_asgn
WHERE series_id = 'Series5'
GROUP BY pv_id
) min_query WHERE max_query.pv_id = min_query.pv_id
ORDER BY max_query.sgnl_idThe data set in the table is quite large, but the above query returns only 49 results (one for each signal in 'Series5').
I tried the following statement by itself to get the last value, but it takes quite a long time to execute (increased the overall query time from 1 sec to 400+ sec when used in the query above):
SELECT DISTINCT trunc(smpl_dte) as the_day,
first_value(integ_since_val) over (partition by trunc(smpl_dte) order by smpl_dte desc) as last_val_per_day
FROM diag.blm_acct WHERE pv_id = 3 and trunc(smpl_dte) = to_date('05/18/2008', 'MM-DD-YYYY ')Any thoughts?Well here is an example of the output I'm trying to generate:
SGNL RESULT_VAL
CCL_Diag:BLM00:Slow60PulsesTotalLoss 52.843439255
CCL_Diag:BLM101:Slow60PulsesTotalLoss 55.7883452511etc...
Here is the table structure:
describe diag.blm_acct;
Name Null Type
BLM_ACCT_ID NOT NULL NUMBER(12)
PV_ID NOT NULL NUMBER(38)
SMPL_DTE NOT NULL DATE
INTEG_OVER_VAL BINARY_DOUBLE()
INTEG_SINCE_VAL BINARY_DOUBLE()
INTEG_TYPE_ID NUMBER(3)
describe diag.PV_SGNL_ID_ASSC
Name Null Type
PV_ID NOT NULL NUMBER(38)
SGNL_ID NOT NULL VARCHAR2(75)
describe diag.SERIES_SGNL_REC_ASGN
Name Null Type
SERIES_ID NOT NULL VARCHAR2(50)
SGNL_ID NOT NULL VARCHAR2(75)
DISP_ORD_NBR NUMBER The main problem I'm having is how to replace this line of code:
WHERE t2.smpl_dte = TO_DATE ('11/15/2008 12:00:00 PM', 'MM-DD-YYYY HH:MI:SS AM')with something that will get the last value (integ_since_val) in the diag.blm_acct table for the 11/15 date.
Edited by: Solerous on Feb 18, 2009 11:32 AM - I figured out how to output the table data -
Getting the week number for a given date
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
PL/SQL Release 11.1.0.7.0 - Production
CORE 11.1.0.7.0 Production
TNS for 64-bit Windows: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - Production
Hello all.
I am currently migrating our product from SQL SERVER to ORACLE and have the following issue.
Basically I'm just trying to get the year week number for a given date but I'm having trouble with Oracle as it seems to think that the weeks run from Thursday to Thursday?. I presume this is something to do with the fact that the first day of the year was Thursday?
e.g.
SQL SERVER:
select DATEPART(wk, '2009-10-24') as Sat -- 43 - correct
select DATEPART(wk, '2009-10-25') as Sun -- 44 - correct
select DATEPART(wk, '2009-10-26') as Mon -- 44 - correct
select DATEPART(wk, '2009-10-27') as Tue -- 44 - correct
select DATEPART(wk, '2009-10-28') as Wed -- 44 - correct
select DATEPART(wk, '2009-10-29') as Thu -- 44 - correct
select DATEPART(wk, '2009-10-30') as Fri -- 44 - correct
select DATEPART(wk, '2009-10-31') as Sat -- 44 - correct
select DATEPART(wk, '2009-11-1') as Sun -- 45 - correct
select DATEPART(wk, '2009-11-2') as Mon -- 45 - correct
select DATEPART(wk, '2009-11-3') as Tue -- 45 - correct
select DATEPART(wk, '2009-11-4') as Wed -- 45 - correct
select DATEPART(wk, '2009-11-5') as Thu -- 45 - correct
ORACLE:
SELECT to_char(to_date('24-OCT-2009'), 'ww') as Sat from dual; -- 43 correct
SELECT to_char(to_date('25-OCT-2009'), 'ww') as Sun from dual; -- 43 incorrect - should be 44
SELECT to_char(to_date('26-OCT-2009'), 'ww') as Mon from dual; -- 43 incorrect - should be 44
SELECT to_char(to_date('27-OCT-2009'), 'ww') as Tue from dual; -- 43 incorrect - should be 44
SELECT to_char(to_date('28-OCT-2009'), 'ww') as Wed from dual; -- 43 incorrect - should be 44
SELECT to_char(to_date('29-OCT-2009'), 'ww') as Thu from dual; -- 44 correct
SELECT to_char(to_date('30-OCT-2009'), 'ww') as Fri from dual; -- 44 correct
SELECT to_char(to_date('31-OCT-2009'), 'ww') as Sat from dual; -- 44 correct
SELECT to_char(to_date('1-NOV-2009'), 'ww') as Sun from dual; -- 44 incorrect - should be 45
SELECT to_char(to_date('2-NOV-2009'), 'ww') as Mon from dual; -- 44 incorrect - should be 45
SELECT to_char(to_date('3-NOV-2009'), 'ww') as Tue from dual; -- 44 incorrect - should be 45
SELECT to_char(to_date('4-NOV-2009'), 'ww') as Wed from dual; -- 44 incorrect - should be 45
SELECT to_char(to_date('5-NOV-2009'), 'ww') as Thu from dual; -- 45 correct
Now I don't want to get into a discussion with regard to locales etc.
In my world (and is seems SQL SERVER's) the first day of the week is Sunday and the last Saturday.
Is there some NLS_? setting or something that I'm missing?
thanks for any help on this.
AndyThis is what you need.
SELECT ceil(( 7+(trunc(to_date('25-OCT-2009'),'d')-trunc(to_date('25-OCT-2009'),'Y')) )/7) FROM dual
HTH!!!
--tested all these statements.
Works as you wish!!
SELECT ceil(( 7+(trunc(to_date('24-OCT-2009'),'d')-trunc(to_date('24-OCT-2009'),'Y')) )/7) as Sat from dual;
SELECT ceil(( 7+(trunc(to_date('25-OCT-2009'),'d')-trunc(to_date('25-OCT-2009'),'Y')) )/7) as Sun from dual;
SELECT ceil(( 7+(trunc(to_date('26-OCT-2009'),'d')-trunc(to_date('26-OCT-2009'),'Y')) )/7) as Mon from dual;
SELECT ceil(( 7+(trunc(to_date('27-OCT-2009'),'d')-trunc(to_date('27-OCT-2009'),'Y')) )/7) as Tue from dual;
SELECT ceil(( 7+(trunc(to_date('28-OCT-2009'),'d')-trunc(to_date('28-OCT-2009'),'Y')) )/7) as Wed from dual;
SELECT ceil(( 7+(trunc(to_date('29-OCT-2009'),'d')-trunc(to_date('29-OCT-2009'),'Y')) )/7) as Thu from dual;
SELECT ceil(( 7+(trunc(to_date('30-OCT-2009'),'d')-trunc(to_date('30-OCT-2009'),'Y')) )/7) as Fri from dual;
SELECT ceil(( 7+(trunc(to_date('01-NOV-2009'),'d')-trunc(to_date('01-NOV-2009'),'Y')) )/7) as Sat from dual;
SELECT ceil(( 7+(trunc(to_date('02-NOV-2009'),'d')-trunc(to_date('02-NOV-2009'),'Y')) )/7) as Sun from dual;
SELECT ceil(( 7+(trunc(to_date('03-NOV-2009'),'d')-trunc(to_date('03-NOV-2009'),'Y')) )/7) as Mon from dual;
SELECT ceil(( 7+(trunc(to_date('04-NOV-2009'),'d')-trunc(to_date('04-NOV-2009'),'Y')) )/7) as Tue from dual;
SELECT ceil(( 7+(trunc(to_date('05-NOV-2009'),'d')-trunc(to_date('05-NOV-2009'),'Y')) )/7) as Wed from dual;
SELECT ceil(( 7+(trunc(to_date('06-NOV-2009'),'d')-trunc(to_date('06-NOV-2009'),'Y')) )/7) as Thu from dual;
Cheers!!!
Bhushan
Edited by: Buga on Oct 29, 2009 10:46 AM -
How can i implement the default value for this variable?
In one of our Stored procs,we have a variable RECS_TO_DELETE, which determines the number of records to delete from various DELETEs that happen within this proc.
The value for RECS_TO_DELETE variable should be obtained from a configuration table sys_config
select
rec_num into RECS_TO_DELETE
from sys_config
where
sys_code=55;
But if something goes wrong with sys_config table or the above SELECT INTO, our client wants to makes sure that RECS_TO_DELETE should have a default value of 1000.
In the code, how will i implement having this default value of 1000 for RECS_TO_DELETE variable in case the above SELECT INTO fails for some reason.Hi,
You have to assign a value before the execution...
DECLARE
RECS_TO_DELETE NUMBER(9) := 1000;
BEGIN
SELECT rec_num
INTO RECS_TO_DELETE
FROM sys_config
WHERE sys_code = 55;
DBMS_OUTPUT.put_line(RECS_TO_DELETE);
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.put_line(RECS_TO_DELETE);
END;
/Regards, -
Inserting the default value for non existing date
hello,
i am designing a matrix report for payslip for month wise in oracle 6i report builder.
in that i want to display per day working hours of the month.
i m using following query for achieving my goal :
select a.paycode,b.empname,c.departmentname,to_char(a.dateoffice,'DD') dateoffice,a.shiftattended,round(decode(a.hw,0,a.mannual_hours,a.hw),0) hw,
a.ISMANNUAL,A.STATUS
from tbltimeregister1 a,
tblemployee b,
tbldepartment c
where a.paycode=b.paycode and
(a.hw >0 or a.mannual_hours is not null ) and
a.departmentcode='D05' AND
a.departmentcode=c.departmentcode and
a.dateoffice between to_date('01/12/2012','dd/mm/yyyy') and to_date('31/12/2012','dd/mm/yyyy')
ORDER BY A.PAYCODE,A.DATEOFFICEit is displaying the hours for the date in b/w date ranges exist in master table.
my problem is that if any date of a month is not in master data ,it should display the given date in DD format with 0 hours , A(absent) status, and null shift by default.
pl tell me how to modify my query for getting my desirable result.
Thanking You
Regards
Vishal Agrawal965354 wrote:
hello,
select a.paycode,b.empname,c.departmentname,to_char(a.dateoffice,'DD') dateoffice,a.shiftattended,round(decode(a.hw,0,a.mannual_hours,a.hw),0) hw,
a.ISMANNUAL,A.STATUS
from tbltimeregister1 a,
tblemployee b,
tbldepartment c
where a.paycode=b.paycode and
(a.hw >0 or a.mannual_hours is not null ) and
a.departmentcode='D05' AND
a.departmentcode=c.departmentcode and
a.dateoffice between to_date('01/12/2012','dd/mm/yyyy') and to_date('31/12/2012','dd/mm/yyyy')
ORDER BY A.PAYCODE,A.DATEOFFICEit is displaying the hours for the date in b/w date ranges exist in master table.
my problem is that if any date of a month is not in master data ,it should display the given date in DD format with 0 hours , A(absent) status, and null shift by default.
pl tell me how to modify my query for getting my desirable result.Your problem isn't exactly clear to me. How do you pass the dates to be compared to the DateOffice column? It will be better to ensure the Master table contain data for each date (with some default values) and you will not have to tweak your sql.
Below is a possible solution:
select *
from
select a.paycode,b.empname,c.departmentname,to_char(a.dateoffice,'DD') dateoffice,a.shiftattended,round(decode(a.hw,0,a.mannual_hours,a.hw),0) hw,
a.ISMANNUAL,A.STATUS
from tbltimeregister1 a,
tblemployee b,
tbldepartment c
where a.paycode=b.paycode and
(a.hw >0 or a.mannual_hours is not null ) and
a.departmentcode='D05' AND
a.departmentcode=c.departmentcode and
a.dateoffice between to_date('01/12/2012','dd/mm/yyyy') and to_date('31/12/2012','dd/mm/yyyy')
union
select a.paycode,b.empname,c.departmentname,to_char(&date_variable,'DD') dateoffice,null,round(decode(a.hw,0,a.mannual_hours,a.hw),0) hw,
a.ISMANNUAL,'A'
from tbltimeregister1 a,
tblemployee b,
tbldepartment c
where a.paycode=b.paycode and
(a.hw >0 or a.mannual_hours is not null ) and
a.departmentcode='D05' AND
a.departmentcode=c.departmentcode and
ORDER BY A.PAYCODE,A.DATEOFFICEIf this is not what you are looking for, then
1. Post a script that helps us to create the Tables required in your query
2. Some sample data. That includes the data for master table that has missing dates (4-5 rows should suffice)
3. The expected results from the sample data you posted.
Please do not forget to mention your version:
select * from v$version; -
How to stop user from entering value for already existing data
Hi ,
We have a situation , where we need to give user a template for entering the data and then send it to the database. But we want that if user has already entered the value for a combination, then he should not be allowed to select the same combination again in that template.
In other words , there should be write access but not update access.
So I have two questions related to it:
1. How to build report with giving user , the drop-down list of available members under each dimensions. (I know that we can provide list by writing all of them in excel and then using those values in drop-down)
2. How to restrict the user for selecting the combination which has already been selected.
Need your suggestion
Thanks
SanjayHi Sanjay,
for your first question...
you can build an EVDRE in a hidden area/sheet to display all values of a desired dimension in rows. Set Option SuppressDataCol to 'Y'. Also maintain MemberSet options to display only the values you need.
Now you can reference your DD-box to the key- or description range.
With some VBA-code you can refresh this EVDRE on Workbook_Open and also set the range (attribute ListFillRange?) of you DD-box dynamically to the RowKeyRange.
Hope, it helps.
Regards
Steve -
Last Record Values for a given Date Range
Hi, I have a unique requirement to process/report only the values of the last record found in a date range for a given set of characteristics. The order would be by FISCPER.
For example: I have some data with 3 characteristics.
STORE001 MATN001 2004001 100 PCS
STORE001 MATN001 2004005 75 PCS
STORE001 MATN001 2004006 80 PCS
STORE002 MATN002 2003008 10 PCS
STORE002 MATN002 2004001 15 PCS
STORE002 MATN002 2004004 40 PCS
A selected date range of 2003008 to 2004001 would result in the following records being processed.
STORE001 MATN001 2004001 100 PCS
STORE002 MATN002 2004001 15 PCS
A selected date range of 2004002 to 2004006 would result in the following records being processed.
STORE001 MATN001 2004006 80 PCS
STORE002 MATN002 2004004 40 PCS
How can I accomplish this at runtime? Any ideas?Nope, it's not an inventory scenario. It could be say the last status of a gas meter within a selected date range.
Any other ideas?
I've considered using VKF, but haven't figured out how this would work yet. If I could modify the selected query data prior to query processing I might be able to number the records and then filter on that..... Anyway I'm open to any suggestions or leads!
I won't forget the points for anyone with a solution!
Thanks! -
Dear Experts
I am getting the following error message while adding item in Item Master data. I have modified the following SBO_SP_transactionNotification in SQL server after that could not able to add the item
ALTER proc [dbo].[SBO_SP_TransactionNotification]
@object_type nvarchar(20), -- SBO Object Type
@transaction_type nchar(1), -- [A]dd, [U]pdate, [D]elete, [C]ancel, C[L]ose
@num_of_cols_in_key int,
@list_of_key_cols_tab_del nvarchar(255),
@list_of_cols_val_tab_del nvarchar(255)
AS
begin
-- Return values
declare @error int -- Result (0 for no error)
declare @error_message nvarchar (200) -- Error string to be displayed
select @error = 0
select @error_message = N'Ok'
-- IF @OBJECT_TYPE = '59' AND (@TRANSACTION_TYPE = 'A' or @TRANSACTION_TYPE = 'U')
BEGIN
IF EXISTS(
SELECT T0.Price FROM IGN1 T0
where IsNull(T0.Price, '0') = '0' and T0.DocEntry = @list_of_cols_val_tab_del)
BEGIN
SELECT @ERROR=1,@ERROR_MESSAGE='Please insert the price !'
END
end
-- Select the return values
select @error, @error_message
endHi Rathna,
Just put the SP like this, without the -- before the IF. A -- marks the line as a command therefore you need to uncomment and it will work.
IF @OBJECT_TYPE = '59' AND (@TRANSACTION_TYPE = 'A' or @TRANSACTION_TYPE = 'U')
BEGIN
IF EXISTS(
SELECT T0.Price FROM IGN1 T0
where IsNull(T0.Price, '0') = '0' and T0.DocEntry = @list_of_cols_val_tab_del)
BEGIN
SELECT @ERROR=1,@ERROR_MESSAGE='Please insert the price !'
END
end
Hope it helps -
How can i pass the one value for two bind parameters
hi All,
i have a search Query
select Distinct CONSOLIDATION_SUMMARY_ID,CREATION_DATE,CREATED_BY,BATCH_ID,PROCESS_FLAG,ERROR_MESSAGE,CUSTOMER_ID,BILLING_FREQUENCY
,CONSOLIDATION_LEVEL,SOLD_TO_ORG_ID ,SHIP_TO_ORG_ID ,TRANSACTIONAL_CURR_CODE ,INVOICE_TO_ORG_ID ,PRICE_LIST_ID
,ORIG_SYS_DOCUMENT_REF,INVENTORY_ITEM_ID ,ORGANIZATION_ID ,ORDERED_ITEM ,ORDERED_QUANTITY ,UNIT_LIST_PRICE
,UNIT_SEELING_PRICE,ORDER_QUANTITY_UOM,ORDER_NUMBER ,ORDER_DATE ,INVOICE_NUMBER ,INVOICE_DATE
,FEE_CALCULATION_WORKSHEET_PDF ,TRADE_DETAILS_PDF ,INVOICE_REPORT_PDF ,PRICING_ATTRIBUTE_CONTEXT
,PRICING_ATTRIBUTE ,PRICING_ATTR_VALUE_FROM
from xxcurrnx.xxcur_trade_consol_summary XXSTR
WHERE XXSTR.BATCH_ID=NVL(:1,XXSTR.BATCH_ID)
and XXSTR.CUSTOMER_ID=nvl(:2,XXSTR.CUSTOMER_ID)
But i need to pass only one value to this query: throw the below code
public void passTocusttrxn(String vcustid)
System.out.println("The customer id in trxn vo:"+vcustid);
XxcurtradeconsummaryVOImpl vOrdnumb=getXxcurtradeconsummaryVO1();
vOrdnumb.setWhereClauseParam(0,vcustid);
vOrdnumb.setWhereClauseParam(1,null);
vOrdnumb.executeQuery();
System.out.println("The executed query After is :"+vOrdnumb.getQuery());
But it throws the below exception.
java.sql.SQLException: Missing IN or OUT parameter at index:: 1
could you please tell me how can i achieve this.
Thanks,hi Meher,
i need to pass this value throug the Spell Parameter.
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
super.processRequest(pageContext, webBean);
XxcustdtlsmainAMImpl am=(XxcustdtlsmainAMImpl)pageContext.getApplicationModule(webBean);
if(pageContext.getParameter("PCustID")!=null) // PCustID is the Spell parameter here
if(pageContext.getParameter("PbtchID")!=null)
if(pageContext.getParameter("PordNum")!=null)
String vcustID=pageContext.getParameter("PCustID");
String vOrdNum=pageContext.getParameter("PordNum");
System.out.println("The cust id in PR:"+vcustID);
System.out.println("The cust id in PR:"+vOrdNum);
am.passTocustlinetrxn(vcustID);
how this vcustID value will passed to the search Code.
if(pageContext.getParameter("BatchID")!=null && !pageContext.getParameter("BatchID").equals(""))
String BchID=pageContext.getParameter("BatchID");
int vInBtchID=Integer.parseInt(BchID);
srchVO.setWhereClauseParams(null);
srchVO.setWhereClauseParam(0,vInBtchID);
System.out.println("The Batch ID is :"+vInBtchID);
f=1;
}else
srchVO.setWhereClauseParam(0,null);
if(pageContext.getParameter("CustmeCode")!=null && !pageContext.getParameter("CustmeCode").equals(""))
System.out.println("i am im customer code ");
String vCustID=pageContext.getParameter("CustmeCode");
srchVO.setWhereClauseParams(null);
srchVO.setWhereClauseParam(1,vCustID);
System.out.println("The customer code is "+vCustID);
f=1;
}else
srchVO.setWhereClauseParam(1,null);
if(f==1)
srchVO.executeQuery();
Regards, -
How to store all the columns values into one single column
Hi All,
this is my file layout,i am receiving the data in below format only
emp_no,c1,c2,c3,c4,c5
100 ,1 ,0 ,1 ,0,1
200 ,1 ,0 ,1 ,0,1
300 ,1 ,0 ,1 ,0,1
but i want to store that above data into my table like(from c1 to c5 columns values i want to store in period column)
emp_no,period
100 ,1
100 ,0
100 ,1
100 ,0
100 ,1
200 ,1
200 ,0
200 ,1
200 ,0
200 ,1
300 ,1
300 ,0
300 ,1
300 ,0
300 ,1
please help meStrange but this is it
Processing ...
with original as (
select 100 as id ,1 as v1,0 as v2,1 as v3,0 as v4,1 as v5
from dual
union all
select 200 ,1 ,0 ,1 ,0,1
from dual
union all
select 300 ,1 ,0 ,1 ,0,1
from dual
select id,v1 as res_row
from original
union all
select id,v2
from original
union all
select id,v3
from original
union all
select id,v4
from original
union all
select id,v5
from original
ID RES_ROW
100 1
200 1
300 1
100 0
200 0
300 0
100 1
200 1
300 1
100 0
200 0
300 0
100 1
200 1
300 1
15 row(s) retrievedBye Alessandro
Maybe you are looking for
-
Is there any known limitation on views created on oracle lite ? I could create simple views without any problem. But when the views get a bit complex ( if i use other views inside the view, or if it depends on more than one base table) then I am faci
-
Fonts jarbled in Safari & Mail occasionally...
I just transferred my settings etc. from an eMac to the new iMac G5 via firewire transfer and something that is happening (that also occurred when I first upgraded to 10.4) is that occasionally a website will have jarbled text etc. This also occurs w
-
P-card process available for SRM 5.0 extended classic scenario
Hello, I didn't find the information, so I'm posting this message. Is the p-card functionality available for the extended classic scenario in SRM 5.0 ?
-
Regular expressions Pattern Matching
Test Data 1. xyz<<<testdata>>>123 2. zzz<<<test<<<data>>>ssf 3. sss<<<test<data>>>sffsd Expected Result 1. <<<testdata>>> 2. <<<data>>> 2. <<<test<data>>> Sql Used: select REGEXP_SUBSTR('<<<testdata>>>', '(<<<)([^<<<]*)(>>>)', 1, 1) from dual; For 1
-
Hello, in my invironment the domain-join isn`t working well. In the log : ZTIDomainJoin has attempted to join to domain [Domain.LOCAL] too many times. Count = 4 ZTIDomainJoin 25-6-2013 13:06:20 0 (0x0000) What can i do to fix this issue permanent? Th