Update between date
I have 12 tables for each month of the year.
I need to update a table with condition that date between in the first day of the year an the last of the year.
By example for month January I need to update the table with sys_date_time between 01/01/2006 and 31/01/2006
How I can make this?
Thanks
Like this ?
SQL> create table mytable_january (id number, mydate date);
Table created.
SQL> alter table mytable_january
2 add constraint ck_january
3 check (to_char(mydate,'MM')='01');
Table altered.
SQL> insert into mytable_january values (1, sysdate);
insert into mytable_january values (1, sysdate)
ERROR at line 1:
ORA-02290: check constraint (H89UCBAC.CK_JANUARY) violated
SQL> insert into mytable_january values (1, sysdate-30);
1 row created.
SQL> select * from mytable_january;
1 13/01/07
SQL> Nicolas.
Similar Messages
-
Unable to run bapis for project status update and date update together
Hi Experts,
I have a requirement to update the dates and status of a project WBS at level 4. I am trying to do update the CJ02 Transaction using standard BAPI available. I need to do both Date update and status update in the same LOOP PASS i am using the below mention bapi. when i am doing so i am getting an error Project 'A._____' has been currently processed by ID i.e. my id.
I have tried putting a wait for 2 seconds in the code but its still not working. please find the order below in which i am calling the bapi.
Loop at itab.
if date_changed = 'X'.
CALL FUNCTION 'BAPI_PROJECT_MAINTAIN'
READ TABLE it_error WITH KEY message_type = c_e.
IF sy-subrc <> 0.
Commit
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = c_x
IMPORTING
return = s_ret.
endif.
endif.
if Status_change = 'X'.
CALL FUNCTION 'BAPI_PS_INITIALIZATION' .
CALL FUNCTION 'BAPI_BUS2054_SET_STATUS'
READ TABLE t_result WITH KEY message_type = c_e.
IF sy-subrc NE 0.
CALL FUNCTION 'BAPI_PS_PRECOMMIT'
TABLES
et_return = t_ret.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = c_x
IMPORTING
return = s_ret.
ENDIF.
endif.
WAIT UP TO 4 SECONDS.
endloop.Try to use
SET UPDATE TASK LOCAL.
before each BAPI call.
Did you try to debug through your code, leaving sufficient time between BAPI calls? If it does work like that, then the above statement might help. -
How to update transaction data automatically into MySQL database using PI
Dear All,
With reference to subject matter I want a sincere advice regarding how to update transaction data automatically into MySQL database using PI. Is there any link available where I can get step-by-step process.
Ex: I have a MYSQL database in my organization. Whenever a delivery created in SAP some fields like DO Number, DO quantity, SO/STO number should get updated in MYSQL database automatically.
This scenario is related to updation of transactional data into MYSQL DB and I want your suggestions pertaining to same issue.
Thanks and Regards,
Chandra SekharHi .
Develop a sceanrio between SAP to Database system,When the data updates in SAP Tables read the data and update it in DATA Base using JDBC adapter,but there will be some delay in updating data in MySQL.
serach in sdn for IDOC-TOJDBC sceannario,many documents available for the same.
Regards,
Raja Sekhar -
What is difference between data base structure and stucure in program
what is difference between data base structure and stucure declared in program level . can explain cleary if knows
Hi,
Data base structure is global decalaration you can reffer this structure in any of your developments, when ever you cahange this structure the changes automatically will get updated in all the programs.
coming to structures in program it is local to your program only, if you want to change the structure again you have to open the program and do the necessary changes.
Reward if useful.
Thanks,
Sreeram. -
Finding days in between dates expressed in days.
Hi, i have a table having a structure similar to this:
LP1
TIME_EQ
P_DAY
LP2
17.2
0
MONDAY
16.8
0.25
TUESDAY
17.03
.5
THURSDAY
17
.75
FRIDAY
17.4
1
FRIDAY
16.9
.25
SATURDAY
17.1
.25
SATURDAY
17
.5
SUNDAY
Now, i have two variable dates D1 = October 10, 2013 (Thursday) and D2 = October 13, 2013 (Sunday).
How do i update my table such that only those rows covered between dates D1 and D2 are updated? In this case, rows where P_DAY in (Thursday, Friday, Saturday, Sunday) I will use this for my cursor, my query begins with this:
CURSOR LOAD_PROF is
SELECT LP1, TIME_EQ, P_DAY
FROM LOAD_PROFILE_TEST
WHERE P_DAY in (??? days between D1 & D2).
I hope you get my point. Thanks.Thank you sir for your response. This is the start of my query where I will use that:
DECLARE
CURSOR LOAD_PROF
IS
SELECT LOAD_PROF1,
V_TIME,
PROFILE_DAY,
DECODE(UPPER(PROFILE_DAY),
'MONDAY', 1,
'TUESDAY', 2,
'WEDNESDAY', 3,
'THURSDAY', 4,
'FRIDAY', 5,
'SATURDAY', 6,
'SUNDAY', 7,
'HOLIDAY', 8,
'H_WEEK_T', 9,
'H_WEEK_F', 10)
ORDERBY
FROM LOAD_PROFILE_TEST
WHERE SUBSTATION_CODE = :V_SUBSTATION_CODE
AND CIRCUIT_CODE = :V_CIRCUIT_CODE
AND UPPER(PROFILE_DAY) IN (SELECT UPPER(
TO_CHAR
:V_DATE + (level-1),
'fmDAY'))
FROM dual
CONNECT BY LEVEL <=
:V_DATE_IN
- :V_DATE
+ 1 )
ORDER BY ORDERBY, V_TIME;
V_PROF NUMBER;
Y_OUT1 NUMBER;
Y_OUT2 NUMBER;
Y_OUT3 NUMBER;
Y_OUT4 NUMBER;
Y_IN1 NUMBER;
Y_IN2 NUMBER;
Y_IN3 NUMBER;
Y_IN4 NUMBER;
Y_OUT NUMBER;
Y_IN NUMBER;
Y_OUT_A NUMBER;
Y_IN_A NUMBER;
Y_OUT_B NUMBER;
Y_IN_B NUMBER;
OUT_EXCL NUMBER;
IN_EXCL NUMBER;
OUT_EXCL_A NUMBER;
IN_EXCL_A NUMBER;
OUT_EXCL_B NUMBER;
IN_EXCL_B NUMBER;
UPPER_AREA NUMBER;
LOWER_AREA NUMBER;
UPPER_AREA_A NUMBER;
LOWER_AREA_A NUMBER;
UPPER_AREA_B NUMBER;
LOWER_AREA_B NUMBER;
DURATION NUMBER;
BEGIN
IF :LOAD_DIFF < > 0
THEN
FOR UE IN LOAD_PROF
LOOP
EXIT WHEN LOAD_PROF%NOTFOUND;
UPDATE LOAD_PROFILE_TEST
SET LOAD_PROF2 = LOAD_PROF1 + :LOAD_DIFF;
END LOOP;
ELSE
FOR UE IN LOAD_PROF
LOOP
EXIT WHEN LOAD_PROF%NOTFOUND;
UPDATE LOAD_PROFILE_TEST
SET LOAD_PROF2 = LOAD_PROF1;
END LOOP;
END IF;
COMMIT;
CALC_UE_AREA(:V_DATE, :V_SUBSTATION_CODE, :V_CIRCUIT_CODE);
CALC_UE_CUMUL_AREA(:V_DATE, :V_SUBSTATION_CODE, :V_CIRCUIT_CODE);
The column AREA is dependent from the column LOAD_PROF2, which I got by updating all the row in my cursor. The column CUMUL_AREA in turn, is dependent on the column AREA. After running these 2 procedures, i will now be able to compute for parameters which i need, using extrapolation method on the dates, LOAD_PROF2 & CUMUL_AREA
Anyways, I will be proceeding with this query for now. I hope you can give me a better suggestion onhow to better approach my problem. Thanks very much for your help. I will now close this thread but again, I will still wait for your suggestion. Thanks again. -
I am trying to update a date type coloumn in table;
declare
cursor cur is
select current_doh
from adp_service_dates71608
for update of adp_service_dates71608.current_doh;
rec cur%rowtype;
begin
for rec in cur loop
dbms_output.put (
to_char (rec.current_doh
if rec.current_doh > 2030 then
update adp_service_dates71608 set to_date(to_char(t.current_doh,'ddmmyyyy')-100, 'ddmmyyyy')
where current of cur;
dbms_output.put_line(' updated');
else
dbms_output.new_line;
end if;
end loop;
end;
when I run it I get erro like
ORA-06550: line 11, column 6:
PLS-00103: Encountered the symbol ";" when expecting one of the following:
. ( ) , * % & | = - + < / > at in is mod remainder not range
rem => .. <an exponent (**)> <> or != or ~= >= <= <> and or
like LIKE2_ LIKE4_ LIKEC_ as between from using || multiset
member SUBMULTISET_
The symbol ")" was substituted for ";" to continue.
ORA-06550: line 13, column 57:
PLS-00103: Encountered the symbol "(" when expecting one of the following:
ORA-06550: line 13, column 99:
PLS-00103: Encountered the symbol ")" when expecting one of the following:
, * & - + / at mod remainder rem <an identifier>
<a double-quoted delimited-identifier> <an exponent (**)> as
from into || multiset bulk
what error?
thanksI formatted it for you:
declare
cursor cur is
select current_doh
from adp_service_dates71608
for update of adp_service_dates71608.current_doh;
rec cur%rowtype;
begin
for rec in cur loop
dbms_output.put ( to_char (rec.current_doh );
if rec.current_doh > 2030 then
update adp_service_dates71608
set to_date(to_char(t.current_doh,'ddmmyyyy')-100, 'ddmmyyyy')
where current of cur;
dbms_output.put_line(' updated');
else
dbms_output.new_line;
end if;
end loop;
end;Check the number of opening and closing brackets in the dbms_output.put statement. Also, the syntax of UPDATE is
UPDATE sometable SET somecolumn = somevalue WHERE ...Also "rec cur%rowtype;" is not needed or used. The Cursor FOR loop construction implicitly declares its own, and the one you declared at the top is ignored.
Message was edited by:
William Robertson -
How to create Dynamic Parameters for between dates
Hi,
I have a requirement to create a crystal report with between dates using dynamic parameters.
I am getting data from 'BEx Query' where already filters were defined on Date field. So While I am creating a crystal report these filters are displaying under 'Parameter Fields' automatically as Static. When I execute the report I am getting these Date's as Dropdown box. But as per the 'help' in crystal reports, static values won't get updated if any changes were taken place in backend system.
I have created a Dynamic parameter 'StartDate', but the values are not getting populated in Dropdown box.
Please let me know how to achieve this requirement.
Thanks in advance.
cheers
devPlease re-post if this is still an issue or purchase a case and have a dedicated support engineer work with your directly
-
Database changes between data records of PSA
Hi all,
Does anybody know a way, how to flush or commit database change between processing each data record from PSA by transfer rules?
I have some routines in transfer rules (updating attributes of master data from datasource), where I need values from exactly previously processed data record. But SELECT from /BIC/Q... table gives me no changes of these values
Command of selection is written correctly, because it gives me new values in next run of DTP process.
And little explanation, what I'm trying to achieve:
In PSA I have account, date and value and I need count, how this value changed for a concrete day and store this value to time-dependent attribute of master data. All data records with the same key (duplicate record) overwrite the result of previously one, so only last one is stored in master data.
Shortly, I need something like aggregation ADDING of routine in transfer rule detail, but able to catch duplicate records.
Thank you for any idea.
Regards, FilipSome note about investigation process.
I tried change my data flow and made the same transfer rules from data source to ODS, if it will behave in different way.
I have found data records correctly collected (agregated) in New data of ODS, but EMPTY in active data! So I think, the something similar happend in case of updating master data, and that's why I didn't saw any agregation.
There is no need to call-out database changes, but this problem is kind od anythink else
This shoud be for a new thread, but how can keyfigures become empty after activation?? I've searched forum and found only a case, when End routines are implemented and they skip update rules, whitch are initial. This is not my case.
Nice to hear from you any ideas. Thankx for reading.
Filip -
Difference between data target & Infoprovider.
Hi all,
Difference between data target & Infoprovider.
why cube is best in performance wise other than ods,multiproviders.
Thanks,
cheta.A data target is an object into which data is loaded. Data targets are the physical objects relevant during data modeling and when loading the data.
Structure
Data targets are:
InfoCubes
ODS objects
InfoObjects (characteristics with attributes, texts or hierarchies).
There are differences between:
Pure data targets for which no queries can be created or executed. An InfoCube might only be used as a data source for another InfoCube. This is also possible for ODS objects and InfoObjects.
If you want a characteristic to appear in the InfoProvider tree, you have to assign an InfoArea to it. You can define update rules for the characteristic in the InfoProvider tree, and use them to load attributes and texts.
You can turn a characteristic into a data target only if the characteristic contains texts or attributes. It is not possible to use update rules to load hierarchies.
Data targets for which queries can be defined. These are called InfoProviders.
<Request for points removed>
Regards
Hemant
Message was edited by:
Moderator -
Difference between Data-centric and Document-centric use
Hi,
Can someone suggest what exactly is the difference between Data-centric and Document-centric use and examples if any.
Thanks in advance.
ChaitanyaMaybe it helps if you look at it this way...
Document centric: document centric use of xml data is data that you always use in its complete form. If you want to use the data, then you always will retrieve it as one entity or you save it as one entity. You are not interested in the xml data / information inside this "package" / document, you are only interested in its total form. Lets say, you have an invoice which can be printed on one sheet of paper. This paper that contains you data, will always be treated in a document driven way, that is, in its total representation: information containted on a sheet of paper (document).
Data centric. data centric use of xml, is usage of data were the main interest point is focused on only pieces of the total set of xml data within a document. So instead of being interested in the whole invoice, you only are interested in information like "amount of money to be payed" or "invoicenumber".
Handling of XML data comes with (hidden) costs. Knowing how your data will be used, has to be used, is one of the first steps in designing you environment (and will have an big impact if you choose poorly). For instance, if you know that your data will always be handled (and must be stored) in a document driven way, then it will make sense to store it based on CLOB based XMLType storage. This will garantee best performance retrieval for your xml document. If you now that your xml data has to be stored so that it can be handled in a data centric way, then Object Relational XMLType storage. If conditions are setup properly data retrieval, inserts and updates will be more cost efficient then when based on CLOB XMLType storage.
There are more differences and "cost markers" when or when not to use CLOB, OR or for instance Binary XML. The first two chapters of the XMLDB Developers Guide for Oracle 11g will give you a good head start making some of those decisions. Be also aware that you probably will have to make compromises. The current state of XML, for example, doesn't have the final solution yet for a uniform storage method.
Message was edited by:
Marco Gralike -
How to update the data in database in webdynpro
I have to update the data in databse table using adaptive rfc in WebDynPro
Hi,
You can refer to these links:
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/wdjava/faq%2b-%2bmodels%2b-%2badaptive%2brfc
Update data into SAP Table
http://help.sap.com/saphelp_nw70/helpdata/en/41/38bc8f813719488ddc9d9b21251ec3/frameset.htm
http://help.sap.com/saphelp_nw70/helpdata/en/d5/1558bfa6aa80499113983e738b1b21/frameset.htm
Regards
Inder -
How to Update the data in R/3 From BW
Hi All ,
I Need some suggestion . i want to update the data of MARC table in R/3 from BW . Here data goes from BW to R/3 . so How to do this ? . There are no standard BAPI's in BW for this .
Thanks
Prithvi.Hi,
The scenario you are explaining is little opposite to what happens generally. Are you sure, you want to update R/3 from BW?
If you have to update MARC table that means you have to extend the material for different plants. Try using BAPI_MATERIAL_SAVE_DATA.
Regards,
Ravi
Note : Please mark all the helpful answers -
I am trying to develop a query in MS Access 2010 to join two tables using three joins, one of which is a (between) date range. The tables are contained in Access. The reason
the tables are contained in access because they are imported from different ODBC warehouses and the data is formatted for uniformity. I believe this cannot be developed using MS Visual Query Designer. I think writing a query in SQL would be suiting this project.
ABCPART links to XYZPART. ABCSERIAL links to XYZSERIAL. ABCDATE links to (between) XYZDATE1 and ZYZDATE2.
[ABCTABLE]
ABCORDER
ABCPART
ABCSERIAL
ABCDATE
[ZYXTABLE]
XYZORDER
XYZPART
XYZSERIAL
XYZDATE1
XYZDATE2Thank you for the looking at the post. The actual table names are rather ambiguous. I renamed them so it would make more sense. I will explain more and give the actual names. What I do not have is the actual data in the table. That is something I don't have
on this computer. There are no "Null" fields in either of the tables.
This table has many orders (MSORDER) that need to match one order (GLORDER) in GLORDR. This is based on MSPART joined to GLPART, MSSERIAL joined to GLSERIAL, and MSOPNDATE joined if it falls between GLSTARTDATE and GLENDDATE.
[MSORDR]
MSORDER
MSPART
MSSERIAL
MSOPNDATE
11111111
4444444
55555
2/4/2015
22222222
6666666
11111
1/6/2015
33333333
6666666
11111
3/5/2015
This table has one order for every part number and every serial number.
[GLORDR]
GLORDER
GLPART
GLSERIAL
GLSTARTDATE
GLENDDATE
ABC11111
444444
55555
1/2/2015
4/4/2015
ABC22222
666666
11111
1/5/2015
4/10/2015
AAA11111
555555
22222
3/2/2015
4/10/2015
Post Query table
GLORDER
MSORDER
GLSTARTDATE
GLENDDATE
MSOPNDATE
ABC11111
11111111
1/2/2015
4/4/2015
2/4/2015
ABC22222
22222222
1/5/2015
4/10/2015
1/6/2015
ABC22222
33333333
1/5/2015
4/10/2015
3/5/2015
This is the SQL minus the between date join.
SELECT GLORDR.GLORDER, MSORDR.MSORDER, GLORDR.GLSTARTDATE, GLORDR.GLENDDATE, MSORDR.MSOPNDATE
FROM GLORDR INNER JOIN MSORDR ON (GLORDR.GLSERIAL = MSORDR.MSSERIAL) AND (GLORDR.GLPART = MSORDR.MSPART); -
Updating array data in sql database
HI,
Im facing problems in updating array data in SQL database.
As of now, i am able to write an "insert" query and insert array data in an image datatype field. Im using image datatype because the array size is very big(around 80,000 x and y values).
Althoug inserting data is easy im unable to write a query to update this data.
Referring to the help of SQL server and Labview database connectivity toolkit, i came across a method of accessing image datatype....using textpointers, which are 16 bit binary values and using the WRITETEXT function instead of the UPDATE function.
but the problem im facing is that ive to pass the array as a 2d string array in the query as a result the updated array is retrieved in the form of a string a
nd not as an array. how do I get over this problem?Hi Pavitra,
I'm not very clear on how you have inserted the data into your application, but I do know that when you call the UPDATETEXT or WRITETEXT function you use the TEXTPOINTERS to point to the first location of a 1d array. So, depending on how you've stored the data, you may have problems updating your data if you're looking at it as a 1d array instead of how you originally formatted it. If you are able to successfully access the data as a 1d array, you can use the database variant to data type vi and pass in a string array constant for the data type. This will convert the variant datatype into whatever you specify. You may have to index the row and column of the variant (you receive a 2d array of variant) first before you convert. If possible, can yo
u provide some more detail and maybe some example code of how you perform the insert and plan to do the update? I can probably give you a better solution if I know how you are formatting the data. Thanks!
Jeremy L.
National Instruments
Jeremy L.
National Instruments -
How can I activate the transfer rules for the ODS updating a data target.
We are on BW 3.5 and I'm loading data into the 0FIGL_O10 ODS and then uploading the data into the cube 0FIGL_C10. The data loads just fine to the ODS but when I try to <u><b>'update the data target'</b></u> I get a date & time stamp' error on the info-package transfer rules.
I then Replicate the datasource 80FIGL_O01.
I must then <u><b>'activate' the transfer rules</b></u>.
However I cannot get the transfer rules for 80FIGL_O10 in CHANGE MODE to activate them.
How can I activate the transfer rules for the ODS updating a data target.
The error text is as follows:
DataSource 80FIGL_O10 has to be replicated (time stamp, see long text)
Message no. R3016
Diagnosis
DataSource 80FIGL_O10 does not have the same status as the source system in the Business Information Warehouse.
The time stamp in the source system is 02/15/2007 10:42:33.
The time stamp in the BW system is 11/07/2006 13:11:54.
System response
The load process has been terminated.
<b>Procedure
Copy the DataSource again and then activate the transfer rules that belong to it. You have to activate the transfer rules in every case, even if they are still active after the DataSource has been copied.</b>
Thanks for your assistance.
DennyHi Dennis,
Try, using Business Content to activate your data source
hope this will help you
How activate business content?
http://help.sap.com/saphelp_nw04/helpdata/en/80/1a66d5e07211d2acb80000e829fbfe/frameset.htm
Maybe you are looking for
-
Database base storage stress test
Hi, I have a ucm 11g instance up and running with SSO. I need to test database storage against filesystem storage. Does anyone have any suggestions on how to test this? Also I'm sure I read somewhere (but I can't find it now) that once I go in one di
-
I am fairly new to using Mac computers, I would like to know how to uninstall drivers, software and anything else I may install on my computer. With PC it's very easy, you go the control panel, locate what you want to uninstall and with a few clicks
-
Help! Executing SQL from ASP
This is my Code.. Set OraSession = CreateObject("OracleInProcServer.XOraSession") Set OraDatabase = OraSession.DbOpenDatabase(strDB, strID & "/" & strPASS, 0) OraDatabase.DbExecuteSQL("DELETE tmp_clean;") It then runs a SQL statement which populates
-
Some Observations and questions
I was running my RMI application on 2 different machines, and found out that the applications never called the remote methods (they could find and connect to the remote objects but never called any methods on them). So I read about it and found that
-
Extending object, without calling super constructor
public class Object1 byte index; public Object1(byte i) index = i; public class Object2 extends Object1 private byte j; public Object2() { super((byte) 0); public void setIndex(byte i) j = i; import java.ut