Insert a record with a '&; '.
Hello I need to develop a script that will upload location, name. The only option I have is to create SQL statements to do so.I would need to load this title into a column. When I create the Insert as shown below, I get a command prompt. If I place '&' or '&' then that is what is inserted into my column. I don't want anything around the ampersand. Does anyone have any suggestions?
INSERT INTO XXHR. XXPER_UPDATE_POSITION (POSITION_NAME, NEW_GRADE_NAME, EFFECTIVE_START_DATE, EFFECTIVE_END_DATE, BUSINESS_GROUP_ID) VALUES ('Manager, staffing & Recruiting.0000002216', 'EXH', TO_DATE (July 1, 2011 ',' DD/MM/YYYY '), TO_DATE (December 31, 2012 ',' DD/MM/YYYY '), 101);
Hello
You can use the SQL * more order
SET DEFINE OFF
somewhere before the first statement INSERT to activate the variable substitution feature and therefore treat '&' as any normal character.
Tags: Database
Similar Questions
-
Insert the record with the decimal string?
I want to insert a record with commas, as the below:
Is there a way we can insert commas in the table?INSERT INTO TABLEA(CITY) VALUES('ALBANY,NEWYORK,TROY')
This statement has been inserted
What is your question.
SQL> INSERT INTO TABLEA(CITY) VALUES('ALBANY,NEWYORK,TROY') ; 1 row created.
-
I have A table with columns col1, col2, col3... until the col40
I have table B with 43 columns, of which 40 are exactly the same as those of table A
and 3 others
Table B-> col1, col2, col3... until col40, othercol1, othercol2, othercol3
I want to read a record from A table and insert it into a new record on table B with the
40 communes column values correspondents, the remains of more than 3
Something like:
declare A_rec % rowtype tableA
Select * into A_rec from table where col1 = 'test '.
insert into values of B A_rec, 'othercol1_vaue', 'othercol2_vaue', 'othercol3_vaue '.
Is it possible?
I use oracle 8.1.7 and I'm afraid that this may be a problem :)
Thanks in advance
GBBMaybe a simple LMD will do?
SQL> create table table_1 2 (col1 varchar2(20), 3 col2 varchar2(20), 4 col3 varchar2(20)); Table created SQL> create table table_2 2 (col1 varchar2(20), 3 col2 varchar2(20), 4 col3 varchar2(20), 5 col4 varchar2(20), 6 col5 varchar2(20)); Table created SQL> insert into table_1 2 values 3 ('1','2','3'); 1 row inserted SQL> commit; Commit complete SQL> insert into table_2 2 select t1.*, 'col4_value','col5_value' 3 from table_1 t1; 1 row inserted SQL> commit; Commit complete SQL> select * from table_2; COL1 COL2 COL3 COL4 COL5 -------------------- -------------------- -------------------- -------------------- -------------------- 1 2 3 col4_value col5_value SQL>
-
Mr President.
What is wrong with this sequence, it does not work when, after 3 inserts, I add a new record with the trigger it gives an error.
--SL_CUSTOMERS table data INSERT INTO SL_CUSTOMERS VALUES(1,'Kamrul Hasan',NULL,NULL,'Moghbazar', 'Dhaka','0456789123',NULL,NULL,NULL,'Y',NULL); INSERT INTO SL_CUSTOMERS VALUES(2,'Rabiul Alam',NULL,NULL,'Motijheel', 'Dhaka','0567891234',NULL,NULL,NULL,'Y',NULL); INSERT INTO SL_CUSTOMERS VALUES(3,'Shahed Hasan',NULL,NULL,'2-G/1,2-2,Mirpur', 'Dhaka','0678912345',NULL,NULL,NULL,'Y',NULL);
CREATE SEQUENCE "ALIZA"."SL_CUSTOMERS_SEQ" MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 NOCACHE NOORDER NOCYCLE ; CREATE OR REPLACE TRIGGER SL_CUSTOMERS_TRG BEFORE INSERT ON "ALIZA"."SL_CUSTOMERS" FOR EACH ROW BEGIN IF :NEW.CUSTOMER_ID IS NULL OR :NEW.CUSTOMER_ID < 0 THEN SELECT SL_CUSTOMERS_SEQ.nextval INTO :NEW.CUSTOMER_ID FROM DUAL; END IF; END; /
When I try to insert several records with the seq.nextval it gives error
violation of primary key.
INSERT INTO "ALIZA"."SL_CUSTOMERS" (CUSTOMER_NAME) VALUES ('sdfsd') ORA-00001: unique constraint (ALIZA.SL_CUSTOMERS_PK) violated ORA-06512: at line 1 One error saving changes to table "ALIZA"."SL_CUSTOMERS": Row 4: ORA-00001: unique constraint (ALIZA.SL_CUSTOMERS_PK) violated ORA-06512: at line 1
Concerning
Mr President.
I find the solution by creating a function before the triiger
as below
CREATE SEQUENCE "ALIZA"."SL_CUSTOMERS_SEQ" MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 NOCACHE NOORDER NOCYCLE ; CREATE OR REPLACE FUNCTION get_SL_CUSTOMERS_vId RETURN VARCHAR2 AS BEGIN RETURN SL_CUSTOMERS_SEQ.NEXTVAL; END; / CREATE OR REPLACE TRIGGER SL_CUSTOMERS_TRG BEFORE INSERT ON "ALIZA"."SL_CUSTOMERS" FOR EACH ROW DECLARE dummy VARCHAR2(200); BEGIN dummy := get_SL_CUSTOMERS_vId(); :NEW.CUSTOMER_ID := dummy; END; /
It works very well
Thank you all for the suggestions.
Concerning
-
My O.S. is W.7. 32-bit.
Before, I recently upgraded to XP and using MS Word 2007, I have a (short) Sound Clip of pre-registration<60 secs. )="" and="" then="" insert="" it="" into="" my="">60>
A small icon that looks like a speaker appeared on the Document and that the beneficiary would have left click on it to hear the recording. The Sound Recorder with W7 now seems much more rudimentary than the old version, and I can't find any way to insert messages into My Documents.
Is this even possible or has Microsoft taken a step backward here?
I'd appreciate some help here. Thanks in advance. Mech-Tech.
Original title: Sound Recorder
If I've understood your problem, try this. Create a shortcut to "soundrecorder /file outputfilename.wav" (without the quotes).
Then start soundrecorder via this shortcut and start and stop the recording, it will save so (hopefully) as a wav as before.
I think the problem is, W7 soundrecorder, by default, saves to wma.
If not, try a 3rd free part program such as Audacity (which seems like overkill, but should do the job).
I hope this will help.
-
Hello
I have a created an EO based on a synonym (synonym is created for a Table by using binding remote Db)
I created a from VO of the EO above and added to an AM. When I run the AM and try to insert a record I get following error
[164] BEGIN INSERT INTO TRACK_TRANSACTION_STATUS_BIZ (TRANS_NO, TRANS_ID, START_DATE, LOGIN_USER_ID, SESSION_ID, REFUND_APPLICABLE_IND) VALUES (: 1,: 2,: 3,: 4:5:6) TRANS_STATUS, ISHOP_LOGIN_IND, EMAIL_ADDR_AT_SIGN, TEL_NO_INT_PREFIX, REFUND_APPLICABLE_IND, REFUNDED_IND, CSP_IND RETURNING: 7: 8: 9,: 10,: 11,: 12,: 13; END;
[165] insert link param 1: test
[166] insert link param 2: you
[167] insert link param 3: 2014-10-16 21:37:09.0
[168] insert link param 4: your
[169] insert link param 5: you
[170] insert link param 6: N
OracleSQLBuilderImpl.doEntityDML [171] failed...
[172] X / Open SQL State is: 99999
[173] java.sql.SQLException: ORA-22816: feature not supported with RETURNING clause
ORA-06512: at line 1
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:462)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:931)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:481)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:205)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:548)
at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:213)
at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1111)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1488)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3769)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3904)
at oracle.jdbc.driver.OracleCallableStatement.executeUpdate(OracleCallableStatement.java:9417)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:1512)
at oracle.jbo.server.OracleSQLBuilderImpl.doEntityDML(OracleSQLBuilderImpl.java:429)
at oracle.jbo.server.EntityImpl.doDML(EntityImpl.java:8575)
at oracle.jbo.server.EntityImpl.postChanges(EntityImpl.java:6816)
at oracle.jbo.server.DBTransactionImpl.doPostTransactionListeners(DBTransactionImpl.java:3290)
at oracle.jbo.server.DBTransactionImpl.postChanges(DBTransactionImpl.java:3093)
at oracle.jbo.server.DBTransactionImpl.commitInternal(DBTransactionImpl.java:2097)
at oracle.jbo.server.DBTransactionImpl.commit(DBTransactionImpl.java:2378)
at oracle.adf.model.bc4j.DCJboDataControl.commitTransaction(DCJboDataControl.java:1615)
at oracle.adf.model.binding.DCDataControl.callCommitTransaction(DCDataControl.java:1417)
at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1437)
at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:2150)
at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:740)
at oracle.jbo.uicli.jui.JUActionBinding.actionPerformed(JUActionBinding.java:193)
at oracle.jbo.uicli.controls.JUNavigationBar.doAction(JUNavigationBar.java:412)
at oracle.jbo.jbotester.NavigationBar.doAction(NavigationBar.java:111)
to oracle.jbo.uicli.controls.JUNavigationBar$ NavButton.actionPerformed (JUNavigationBar.java:118)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
in javax.swing.AbstractButton$ Handler.actionPerformed (AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
at java.awt.Component.processMouseEvent(Component.java:6289)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6054)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4652)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
to java.awt.EventQueue.access$ 000 (EventQueue.java:85)
in java.awt.EventQueue$ 1.run(EventQueue.java:603)
in java.awt.EventQueue$ 1.run(EventQueue.java:601)
at java.security.AccessController.doPrivileged (Native Method)
in java.security.AccessControlContext$ 1.doIntersectionPrivilege(AccessControlContext.java:87)
in java.security.AccessControlContext$ 1.doIntersectionPrivilege(AccessControlContext.java:98)
in java.awt.EventQueue$ 2.run(EventQueue.java:617)
in java.awt.EventQueue$ 2.run(EventQueue.java:615)
at java.security.AccessController.doPrivileged (Native Method)
in java.security.AccessControlContext$ 1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
[174] OracleSQLBuilder: ROLLBACK WORK point registration "BO_SP".
[175] DCBindingContainer.reportException: oracle.jbo.DMLException
oracle.jbo.DMLException [176]: Houston-26041: could not publish data from database in "Insert": SQL statement ' BEGIN INSERT INTO TRACK_TRANSACTION_STATUS_BIZ (TRANS_NO, TRANS_ID, START_DATE, LOGIN_USER_ID, SESSION_ID, REFUND_APPLICABLE_IND) VALUES (: 1,: 2,: 3,: 4: 5:6) TRANS_STATUS, ISHOP_LOGIN_IND, EMAIL_ADDR_AT_SIGN, TEL_NO_INT_PREFIX, REFUND_APPLICABLE_IND. , REFUNDED_IND, CSP_IND INTO TURNING: 7: 8: 9: 10: 11:12:13; END; ».
at oracle.jbo.server.OracleSQLBuilderImpl.doEntityDML(OracleSQLBuilderImpl.java:583)
at oracle.jbo.server.EntityImpl.doDML(EntityImpl.java:8575)
at oracle.jbo.server.EntityImpl.postChanges(EntityImpl.java:6816)
at oracle.jbo.server.DBTransactionImpl.doPostTransactionListeners(DBTransactionImpl.java:3290)
at oracle.jbo.server.DBTransactionImpl.postChanges(DBTransactionImpl.java:3093)
at oracle.jbo.server.DBTransactionImpl.commitInternal(DBTransactionImpl.java:2097)
at oracle.jbo.server.DBTransactionImpl.commit(DBTransactionImpl.java:2378)
at oracle.adf.model.bc4j.DCJboDataControl.commitTransaction(DCJboDataControl.java:1615)
at oracle.adf.model.binding.DCDataControl.callCommitTransaction(DCDataControl.java:1417)
at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1437)
at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:2150)
at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:740)
at oracle.jbo.uicli.jui.JUActionBinding.actionPerformed(JUActionBinding.java:193)
at oracle.jbo.uicli.controls.JUNavigationBar.doAction(JUNavigationBar.java:412)
at oracle.jbo.jbotester.NavigationBar.doAction(NavigationBar.java:111)
to oracle.jbo.uicli.controls.JUNavigationBar$ NavButton.actionPerformed (JUNavigationBar.java:118)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
in javax.swing.AbstractButton$ Handler.actionPerformed (AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
at java.awt.Component.processMouseEvent(Component.java:6289)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6054)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4652)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
to java.awt.EventQueue.access$ 000 (EventQueue.java:85)
in java.awt.EventQueue$ 1.run(EventQueue.java:603)
in java.awt.EventQueue$ 1.run(EventQueue.java:601)
at java.security.AccessController.doPrivileged (Native Method)
in java.security.AccessControlContext$ 1.doIntersectionPrivilege(AccessControlContext.java:87)
in java.security.AccessControlContext$ 1.doIntersectionPrivilege(AccessControlContext.java:98)
in java.awt.EventQueue$ 2.run(EventQueue.java:617)
in java.awt.EventQueue$ 2.run(EventQueue.java:615)
at java.security.AccessController.doPrivileged (Native Method)
in java.security.AccessControlContext$ 1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.sql.SQLException: ORA-22816: feature not supported with RETURNING clause
ORA-06512: at line 1
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:462)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:931)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:481)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:205)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:548)
at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:213)
at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1111)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1488)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3769)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3904)
at oracle.jdbc.driver.OracleCallableStatement.executeUpdate(OracleCallableStatement.java:9417)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:1512)
at oracle.jbo.server.OracleSQLBuilderImpl.doEntityDML(OracleSQLBuilderImpl.java:429)
... 52 more
# # 0 in detail
java.sql.SQLException: ORA-22816: feature not supported with RETURNING clause
ORA-06512: at line 1
Ask for help in this regard
ADF will generate default DML statement with RETURNING clause, and it is not applicable to your use case: ORA-22816: feature not supported with RETURNING clause
Instead, you can try with setUseReturningClause (false): http://docs.oracle.com/middleware/1213/adf/develop/adf-bc-entity-objects.htm#BABJAJCA
Dario
-
Insert the record of one table to another with the help of the cursor
Help, please!
the tables are - 1. countries (country_id pk, country_name, region_id)
2A (country_id, country_name, region_id)
table data are
1 to 1
2 b 2
3 C 3
NULL d 4
5 e 5
6 f 6
7 g 7
-----------------------
Insert the record in the table a country table with the help of the cursor, insert all the non-null records.
This procedure does not correct result
-----------------------
create or replace
Amit procedure as
cursor c1 is select * from a;
RW a % rowtype;
Start
Open c1;
Fetch c1 into rw.
While (C1% found)
loop
insert into countries values (rw.country_id, rw.country_name, rw.region_id);
commit;
Fetch c1 into rw.
If rw.country_id is null then
Fetch c1 into rw.
end if;
end loop;
Close c1;
exception
while others then
dbms_output.put_line ('exception = name ' |) RW.country_name);
end;You don't need cursor at all;
create or replace procedure amit as begin insert into countries (Country_ID, Country_Name, Region_ID) (select a.Country_ID ,a.Country_Name ,a.Region_ID from a ); dbms_output.put_line('Rows inserted : ' || sql%rowcount); commit; end; /
-
Insert multiple records in a form with checkboxes
Hello
I need to insert multiple records in a database of a form using Coldfusion and am stuck - it works correctly when inserting one record at a time. Basically, the user will choose their name of the employee (EmployeeID) in a dynamic list, then several session (open) numbers that represent classes of training.
When I try and select several check boxes, I get this error:
"The number of query values and destination fields is not the same."
The boxes of the open field are not dynamic, as you can see-how use CFLOOP or any other method to allow several checkboxes be selected, and all open documents is entered into the database on a form?
I used server behaviors Dreamweaver 8 to create the form - which is limiting I know but I'm not a coder. I hope I can add code here to do things correctly function.
----APPLICATION CODE------------------------------------------------------------------
<!-get employee names->
< cfquery name = "rsDisplayEmployee" datasource = "FormationRH" >
SELECT *.
OF tblEmployees
ORDER BY LastName ASC < / cfquery >
<!-->-->
<! - insert Records - >
< cfset CurrentPage = GetFileFromPath (GetTemplatePath ()) >
< cfif IsDefined "(FORM. MM_InsertRecord") AND the FORM. MM_InsertRecord EQ 'form1' >
< cfquery datasource = "FormationRH" >
INSERT INTO tblEnrollments (open, EmployeeID)
VALUES)
< cfif IsDefined "(FORM. Open") AND #FORM. Open # NEQ "" > "".
#FORM. Open #.
< cfelse >
NULL VALUE
< / cfif >
,
< cfif IsDefined "(FORM. EmployeeID") AND #FORM. EmployeeID # NEQ "" > "".
#FORM. EmployeeID #.
< cfelse >
NULL VALUE
< / cfif >
) < / cfquery >
< cflocation url = "2.cfm" >
< / cfif >
<!-->-->
--------FORM CODE-----------------------------------------------------------------------
< form action = "" < cfoutput > #CurrentPage # < / cfoutput > "id = 'form' name ="form"method ="POST">"
< table width = "100%" border = "0" cellspacing = "0" cellpadding = "4" >
< b >
< td width = "100%" > < h2 > < strong > select an employee name < facilities > < / h2 > < table >
< /tr >
< b >
< td > < select name = "EmployeeID" >
< cfoutput query = "rsDisplayEmployee" >
< option value = "#rsDisplayEmployee.EmployeeID #" > #rsDisplayEmployee.LastName #, #rsDisplayEmployee.FirstName # < / option >
< / cfoutput >
< / select > < table >
< /tr >
< /table >
< h2 > < strong > select training class < facilities > < / h2 >
< table width = "600" border = "0" cellspacing = "0" cellpadding = "0" >
< b >
< td width = "227" valign = "top" > class < table >
< td width = "373" valign = "top" > < input name = "Open" type = "checkbox" value = "937" / >
Date < table >
< /tr >
< b >
< td valign = "top" > class < table >
< td valign = "top" > < label >
< input name = "Open" type = "checkbox" value = "936" / >
< / label >
Date < table >
< /tr >
< /table >
< br / >
< input type = "submit" name = "Submit" value = 'Sign Up!' / >
< input type = "hidden" name = "MM_InsertRecord" value = "form" >
< / make >
"Add a line" I want to say that, for each of the checkboxes selected in your form, the code will be to insert a new record in the database table. Sorry I probably didn't phrase it very well.
so, no, the code does not need to wrap around each element. Instead the code examines the form.fieldnames variable (form.fieldnames, which is a list separated by commas of all fields defined in the form, is automatically submitted to each form submission - you don't have to define yourself somehow) and for each selected checkbox will insert a new record in your table with the check box selected and selected value the value of the id of the employee.
-
Error when inserting Record with GoDaddy hosting
When I try to insert a recording on a Web page hosted by GoDaddy in SQL server, I get the error:
Microsoft OLE DB provider for ODBC error «80040e09» drivers
[Microsoft] [ODBC SQL Server driver] [SQL Server] EXECUTE permission denied on object 'sp_execute', database 'master', owner 'dbo '.
This error occurs on the line:
MM_editCmd.prepared = true
After some research online if I change the line following the error disappears, but the fact the behavior insert record:
MM_editCmd.prepared = false
Is it possible to change the behavior so that it will always use false instead of true and always appear as a behavior on the page.
What happens in Dreamweaver 8.0.2. It happened not in Dreamweaver MX 2004.
Thank you
MikeAfter a lot of tinkering, I tried a test with a new table and web page. Dreamweaver has added the code to insert as before--the same code that causes the error. I tried the test and it worked. No error?
The only difference I could think about was that the original array was created on a local SQL server server, and then I used generate the SQL Script for the create table statement, I then ran in on the SQL of GoDaddy Server Query Analyzer.
I then removed the table and created through the user interface of GoDaddy and now it works. I don't know what the difference is, but at least it works.
Thank you.
-
is it possible to insert a record in the list of messages inbox BB?
Hi all
I heard that RIM has opened a new API to allow the third-party application to insert a record into Message Inbox with an icon to see the difference.
Is it someone knows this and tips and example would be much appreciated.
Thanks in advance.
If you have downloaded the JDE or plug-in in Eclipse, see the MessageListDemo. This gives you all the information you need to get started.
-
one-to-many selfjoin, delete records with the same rank or a substitution
Sorry for my poor choice of the title of the discussion, feel free to suggest me a more relevant
I rewrote for clarity and as a result of the FAQ post.
Version of DB
I use Oracle10g Enterprise 10.2.0.1.0 64-bit
Tables involved
CREATE TABLE wrhwr ( wr_id INTEGER PRIMARY KEY, eq_id VARCHAR2(50) NULL, date_completed DATE NULL, status VARCHAR2(20) NOT NULL, pmp_id VARCHAR2(20) NOT NULL, description VARCHAR2(20) NULL);
Examples of data
INSERT into wrhwr VALUES (1,'MI-EXT-0001',date'2013-07-16','Com','VER-EXC','Revisione') INSERT into wrhwr VALUES (2,'MI-EXT-0001',date'2013-07-01','Com','VER-EXC','Verifica') INSERT into wrhwr VALUES (3,'MI-EXT-0001',date'2013-06-15','Com','VER-EXC','Revisione') INSERT into wrhwr VALUES (4,'MI-EXT-0001',date'2013-06-25','Com','VER-EXC','Verifica') INSERT into wrhwr VALUES (5,'MI-EXT-0001',date'2013-04-14','Com','VER-EXC','Revisione') INSERT into wrhwr VALUES (6,'MI-EXT-0001',date'2013-04-30','Com','VER-EXC','Verifica') INSERT into wrhwr VALUES (7,'MI-EXT-0001',date'2013-03-14','Com','VER-EXC','Collaudo')
Query used
SELECT * FROM (SELECT eq_id, date_completed, RANK () OVER (PARTITION BY eq_id ORDER BY date_completed DESC NULLS LAST) rn FROM wrhwr WHERE status != 'S' AND pmp_id LIKE 'VER-EX%' AND description LIKE '%Verifica%') table1, (SELECT eq_id, date_completed, RANK () OVER (PARTITION BY eq_id ORDER BY date_completed DESC NULLS LAST) rn FROM wrhwr WHERE status != 'S' AND pmp_id LIKE 'VER-EX%' AND description LIKE '%Revisione%') table2, (SELECT eq_id, date_completed, RANK () OVER (PARTITION BY eq_id ORDER BY date_completed DESC NULLS LAST) rn FROM wrhwr WHERE status != 'S' AND pmp_id LIKE 'VER-EX%' AND description LIKE '%Collaudo%') table3 WHERE table1.eq_id = table3.eq_id AND table2.eq_id = table3.eq_id AND table1.eq_id = table2.eq_id
The above query is intended to selfjoin wrhwr table 3 times in order to have for each line:
- eq_id;
- date of the completion of a verification type work request for this eq_id (aka table1);
- date completion of a line (aka table2) type wr for this eq_id;
- date of completion of a type wr Collaudo (aka table3) for this eq_id;
A separate eq_id:
- can have different completion of many requests for work (wrhwr records) with dates or date of completion (date_completed NULL column).
- in a date range can have all types of wrhwr ('verification', 'Line', 'Problem'), or some of them (e.g. audit, line but not Collaudo, Collaudo but not verification and line, etc.);
- must not repeat the substrings in the description;
- (eq_id, date_completed) are not unique but (eq_id, date_completed, description, pmp_id) must be unique;
Expected results
Using data from the example above, I expect this output:
eq_id, table1.date_completed, table2.date_completed, table3.date_completed
MI-ext-001,2013-07-01,2013-07-16,2013-03-14 <- to this eq_id table3 doesn't have 3 lines but only 1. I would like to repeat the value most in the rankings in table 3 for each line of output
MI-ext-001,2013-07-01,2013-06-15,2013-03-14 <-I don't want this line of table1 and table2 with both 3 lines match must be in terms of grade (1st, 1st) (2nd, 2nd) (3rd, 3rd)
MI-ext-001,2013-06-25,2013-06-15,2013-03-14 <-2nd table1 joined the 2nd row from table2
MI-ext-001,2013-04-30,2013-04-14, 2013-03-14 <-1 table1, table2 rank rank 1, 1st rank table3
In the syntax of vector style, tuple expected output should be:
IX = ranking of the i - th of tableX
(i1, i2, i3) IF EXISTS a rank i - th line in each table
ON THE OTHER
(i1, b, b)
where b is the first available lower ranking of the table2, or NULL if there isn't any line of lower rank.
Clues?
With the query, I am unable to delete the lines "spurius.
I think a solution based on analytical functions such as LAG() and LEAD(), using ROLLUP() or CUBE(), using nested queries, but I would find a solution elegant, simple, fast, and easy to maintain.
Thank you
Hello
Sorry, it's still not quite clear what you are asking.
This becomes the desired resutls of the sample data you posted:
WITH got_r_type AS
(
SELECT eq_id, date_completed
CASE
Description WHEN LIKE '% Collaudo %' THEN 'C '.
Description WHEN AS 'Line %' THEN 'R '.
Description WHEN AS 'Verification %' THEN 'V '.
END AS r_type
OF wrhwr
Situation WHERE! = s "
AND pmp_id LIKE '% WORM - EX'
)
got_r_num AS
(
SELECT eq_id, date_completed, r_type
, ROW_NUMBER () OVER (PARTITION BY eq_id, r_type)
ORDER BY date_completed DESC NULLS LAST
) AS r_num
OF got_r_type
WHERE r_type IS NOT NULL
)
SELECT eq_id
LAST_VALUE (MIN (CASE WHEN r_type THEN date_completed END = ' V')
IGNORES NULL VALUES
) OVER (PARTITION BY eq_id
ORDER BY r_num
) AS audit
LAST_VALUE (MIN (CASE WHEN r_type = 'R' THEN date_completed END)
IGNORES NULL VALUES
) OVER (PARTITION BY eq_id
ORDER BY r_num
) AS line
LAST_VALUE (MIN (CASE WHEN r_type = 'C' THEN date_completed END)
IGNORES NULL VALUES
) OVER (PARTITION BY eq_id
ORDER BY r_num
) AS collauda
OF got_r_num
GROUP BY eq_id
r_num
ORDER BY eq_id
r_num
;
I guess the description can have (at most) only substrings target, in other words, you can't have a line like this:
INSERT into (1,'MI-EXT-0001',date'2013-07-16','Com','VER-EXC','Revisione VALUES wrhwr and audit");
In addition, you said the combination (eq_id, date_comepleted) is not unique, that it is y no example of this in your sample data. What results would you if, in addition to this line (who did the validation):
INSERT into wrhwr VALUES (7,'MI-EXT-0001',date'2013-03-14','Com','VER-EXC','Collaudo');
the following line is also?
INSERT into wrhwr VALUES (97,'MI-EXT-0001',date'2013-03-14','Com','VER-EXCFUBAR','Collaudo');
.
You could do a self-join instead of GROUP BY, but I suspect it will be much less effective. You can use FULL OUTER JOIN, since you do not know what r_types was that r_nums.
-
I implemented a save point in a workflow by creating a save point in the method action following is the managed bean code to create check point:
ControllerContext cc = ControllerContext.getInstance ();
If (cc! = null) {} Bishop SavePointManager = cc.getSavePointManager (); If (mgr! = null) {} The ID of the string = mgr.createSavePoint (); savePointId = id; } It has worked well in local (integrated Weblogic Server). She also worked fine initially when I deployed the changes to the weblogic DEV Server. But after a few days, in DEV I am getting the following error whenever trying to create a server backup point:
Caused by: oracle.adfinternal.controller.savepoint.SavePointException: ADFC-08008: the controller of the ADF cannot insert a record of savepoint for the ID 4 d 233555-ea0c-4bae-9f17-cc6c
7124870f'. oracle.adfinternal.controller.savepoint.SavePointUtil.createAndLogSavePointException(SavePointUtil.java:56)
at oracle.adfinternal.controller.savepoint.SavePointDBPersistManager.insertSavePoint(SavePointDBPersistManager.java:245)
at oracle.adfinternal.controller.savepoint.DBSavePointManagerImpl.storeSavePoint(DBSavePointManagerImpl.java:127)
at oracle.adfinternal.controller.savepoint.SavePointManagerImpl.storeSavePoint(SavePointManagerImpl.java:301)
at oracle.adfinternal.controller.savepoint.SavePointManagerImpl.createAndStoreSavePoint(SavePointManagerImpl.java:257)
at oracle.adfinternal.controller.savepoint.SavePointManagerImpl.createSavePoint(SavePointManagerImpl.java:187)
at oracle.adfinternal.controller.savepoint.SavePointManagerImpl.createSavePoint(SavePointManagerImpl.java:116)
at view.security.errormanagement.ManageErrorsMB.saveTaskFlow(ManageErrorsMB.java:213)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at com.sun.el.parser.AstValue.invoke (unknown Source)
at com.sun.el.MethodExpressionImpl.invoke (unknown Source)
at oracle.adf.controller.internal.util.ELInterfaceImpl.invokeMethod(ELInterfaceImpl.java:173)
at oracle.adfinternal.controller.activity.MethodCallActivityLogic.execute(MethodCallActivityLogic.java:163)
at oracle.adfinternal.controller.engine.ControlFlowEngine.executeActivity(ControlFlowEngine.java:1035)
at oracle.adfinternal.controller.engine.ControlFlowEngine.doRouting(ControlFlowEngine.java:926)
at oracle.adfinternal.controller.engine.ControlFlowEngine.doRouting(ControlFlowEngine.java:824)
at oracle.adfinternal.controller.engine.ControlFlowEngine.routeFromActivity(ControlFlowEngine.java:554)
at oracle.adfinternal.controller.engine.ControlFlowEngine.performControlFlow(ControlFlowEngine.java:158)
at oracle.adfinternal.controller.application.NavigationHandlerImpl.handleAdfcNavigation(NavigationHandlerImpl.java:115)
at oracle.adfinternal.controller.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:84)
at org.apache.myfaces.trinidadinternal.application.NavigationHandlerImpl.handleNavigation(NavigationHandlerImpl.java:50)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:130)
at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
at org.apache.myfaces.trinidad.component.UIXCollection.broadcast(UIXCollection.java:157)
at org.apache.myfaces.trinidad.component.UIXTable.broadcast(UIXTable.java:279)
at oracle.adf.view.rich.component.UIXTable.broadcast(UIXTable.java:145)
at oracle.adf.view.rich.component.rich.data.RichTable.broadcast(RichTable.java:479)
at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:159)
to oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$ 1.run(ContextSwitchingComponent.java:130)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:461)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:134)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:112)
to oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$ 1.run(ContextSwitchingComponent.java:130)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:461)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:134)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:106)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:1129)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:353)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:204)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:122)
to org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$ FilterListChain.doFilter (TrinidadFilterImpl.java:468)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
to org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$ FilterListChain.doFilter (TrinidadFilterImpl.java:468)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
to oracle.security.jps.ee.http.JpsAbsFilter$ 1.run(JpsAbsFilter.java:111)
at java.security.AccessController.doPrivileged(AccessController.java:284)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
to weblogic.servlet.internal.WebAppServletContext$ ServletInvocationAction.wrapRun (WebAppServletContext.java:3715)
to weblogic.servlet.internal.WebAppServletContext$ ServletInvocationAction.run (WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused by: java.sql.SQLException: connection has already been closed.
at weblogic.jdbc.wrapper.PoolConnection.checkConnection(PoolConnection.java:58)
at weblogic.jdbc.wrapper.Connection.preInvocationHandler(Connection.java:94)
at weblogic.jdbc.wrapper.Connection.prepareCall(Connection.java:543)
at oracle.adfinternal.controller.savepoint.SavePointDBPersistManager.insertSavePoint(SavePointDBPersistManager.java:221)
at oracle.adfinternal.controller.savepoint.DBSavePointManagerImpl.storeSavePoint(DBSavePointManagerImpl.java:127)
at oracle.adfinternal.controller.savepoint.SavePointManagerImpl.storeSavePoint(SavePointManagerImpl.java:301)
at oracle.adfinternal.controller.savepoint.SavePointManagerImpl.createAndStoreSavePoint(SavePointManagerImpl.java:257)
at oracle.adfinternal.controller.savepoint.SavePointManagerImpl.createSavePoint(SavePointManagerImpl.java:187)
at oracle.adfinternal.controller.savepoint.SavePointManagerImpl.createSavePoint(SavePointManagerImpl.java:116)
at view.security.errormanagement.ManageErrorsMB.saveTaskFlow(ManageErrorsMB.java:213)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
At the bottom of the stack, this statement ""caused by: java.sql.SQLException: connection has already been closed. ' that intrigues me, but why this error occurs after a few days or after a particular number of connections or access to the application. "
This same problem also happening in all environments including PROD. Help, please. JDeveloper version is 11.1.2.1.0.
We got the support of Oracle solution.
Passivation fails with the error "Connection has already been closed" in PoolConnection.checkConnection () (Doc ID 1330271.1). Problem is due to the grouping feature of connection for the Server WebLogic "timeout idle." When this is configured, WLS right out the strength of the connections in the pool. It is a problem for BC ADF based on maintaining the JDBC connection, associated with sound
Instance of Module of the application.
"Idle Session Timeout" value 0 (default), so that the JDBC connection remains active while
the instance of the corresponding Application Module is active:
Thank you...
-
Hi all
I created a table with two columns method. I am assigned two values to variable recordtype.
When inserting the record in the table, a compiler error is to be there.
ERROR on line 11:Create table emp_info(empno number(5),ename varchar2(30)); DECLARE l_rec emp_info%rowtype; BEGIN l_rec.empno := 101; l_rec.ename := 'KING'; insert into emp_info(empno,ename) values(l_rec); commit; END;
ORA-06550: line 10, column 35:
PL/SQL: ORA-00947: not enough values
ORA-06550: line 10, column 1:
PL/SQL: SQL statement ignored
Can I insert with output Recordtype variables indicating the column names. Can someone help me?Do not list of columns. Do not put brackets in the record variable:
SQL> DECLARE 2 l_rec emp_info%rowtype; 3 BEGIN 4 l_rec.empno := 101; 5 l_rec.ename := 'KING'; 6 insert 7 into emp_info 8 values l_rec; 9 commit; 10 END; 11 / PL/SQL procedure successfully completed. SQL>
SY.
-
Insert the record in the second table by making the trigger on the first table
I hv created 2 tables as shown below the code sql. I want to insert some record (line current value) column of the first table, next sequence value and sysdate into second table. I hv created trigger but I gave warning.
so I want to know what is the problem in my sql code.
Pls correct!
SQL > create table myuser1 (u_id varchar2 (10), uname varchar2 (20), sex char(1));
SQL > create table myuser2 (reg_no number (5), reg_date Date, u_id varchar2 (20));
SQL > create the sequence myuser2_seq;
SQL > alter table myuser1 add constraint pk_myuser1 key (u_id) primary;
SQL > alter table myuser2 add constraint pk_myuser2 key (reg_no) primary;
SQL > CREATE TRIGGER MYTRIGGER
2 AFTER INSERT ON myuser1
3 FOR EACH LINE
4 BEGIN
5 INSERT INTO myuser2 (reg_no, reg_date, u_id)
6 VALUES (myuser2_seq.nextval, SELECT SYSDATE FROM DUAL, select u_id myuser)
1)
7 END;
8.
WARNING: Trigger created with compilation errors.JKMourya wrote:
I hv created 2 tables as shown below the code sql. I want to insert some record (line current value) column of the first table, next sequence value and sysdate into second table. I hv created trigger but I gave warning.
so I want to know what is the problem in my sql code.
Pls correct!SQL > create table myuser1 (u_id varchar2 (10), uname varchar2 (20), sex char(1));
SQL > create table myuser2 (reg_no number (5), reg_date Date, u_id varchar2 (20));
SQL > create the sequence myuser2_seq;
SQL > alter table myuser1 add constraint pk_myuser1 key (u_id) primary;
SQL > alter table myuser2 add constraint pk_myuser2 key (reg_no) primary;
SQL > CREATE TRIGGER MYTRIGGER
2 AFTER INSERT ON myuser1
3 FOR EACH LINE
4 BEGIN
5 INSERT INTO myuser2 (reg_no, reg_date, u_id)
6 VALUES (myuser2_seq.nextval, SELECT SYSDATE FROM DUAL, select u_id myuser)
1)
7 END;
8.WARNING: Trigger created with compilation errors.
SELECT inside VALUES clause is NOT allowed.
do SELECT statements before the INSERT command -
Hi all
This is our requirement.
We must combine records with time.
for example: period = 3
TABLE: XX_SALES
---------------------------------------------
XDATE XQTY
---------------------------------------------
10 5/1/2012
20 2/5/2012
3/5/2012 30
4/5/2012 60
12 2012/5/7
8/5/2012 23
45 8/5/2012
100 12/5 / 2012
5/2012/13 55
5/2012/15 99
== >
---------------------------------------------
XDATE XQTY
---------------------------------------------
1/5/2012 10-> 5/1/2012 Group (5/1/2012 ~ 3/5/2012)
2/5/2012 20-> 5/1/2012 Group (5/1/2012 ~ 3/5/2012)
3/5/2012 30-> 5/1/2012 Group (5/1/2012 ~ 3/5/2012)
4/5/2012 60-> Group 5/2012/4 (4/5/2012 ~ 2012/5/6) *.
7/5/2012 12-> Group 5/2012/7 (5/7/2012 ~ 9/5/2012) *.
8/5/2012 23-> Group 5/2012/7 (5/7/2012 ~ 9/5/2012) *.
8/5/2012 45-> Group 5/2012/7 (5/7/2012 ~ 9/5/2012) *.
5/2012/12 100-> Group 5/12/2012 (2012/5/12 ~ 14/5/2012) *.
13/5/2012 55-> Group 5/12/2012 (2012/5/12 ~ 14/5/2012) *.
5/15/2012 99-> Group 5/15/2012 (15/5/2012 ~ 5/17/2012) *.
After amount to combine with period = 3, the result will be
---------------------------------------------
XDATE_G XQTY_G
---------------------------------------------
60 1/5/2012
4/5/2012 60
2012/5/7 80
12/5/2012 155
5/2012/15 99
Here's the example script
We can solve this problem by using the loop now:create table XX_SALES(XDATE DATE, XQTY Number); insert into XX_SALES VALUES(to_date('20120501','YYYYMMDD'),10); insert into XX_SALES VALUES(to_date('20120502','YYYYMMDD'),20); insert into XX_SALES VALUES(to_date('20120503','YYYYMMDD'),30); insert into XX_SALES VALUES(to_date('20120504','YYYYMMDD'),60); insert into XX_SALES VALUES(to_date('20120507','YYYYMMDD'),12); insert into XX_SALES VALUES(to_date('20120508','YYYYMMDD'),23); insert into XX_SALES VALUES(to_date('20120508','YYYYMMDD'),45); insert into XX_SALES VALUES(to_date('20120512','YYYYMMDD'),100); insert into XX_SALES VALUES(to_date('20120513','YYYYMMDD'),55); insert into XX_SALES VALUES(to_date('20120515','YYYYMMDD'),99);
to find the XDATE_G and it's rank in the loop and the XQTY in the range of the sum.
Is it possible to solve this problem by using analyze sql?DECLARE V_DATE_FROM DATE := NULL; V_DATE_TO DATE := NULL; V_QTY_SUM NUMBER := 0; CURSOR CUR_DATE IS SELECT DISTINCT XDATE FROM XX_SALES ORDER BY XDATE; BEGIN FOR REC IN CUR_DATE LOOP IF V_DATE_TO IS NULL OR REC.XDATE > V_DATE_TO THEN V_DATE_FROM := REC.XDATE; V_DATE_TO := REC.XDATE + 3 - 1; SELECT SUM(XQTY) INTO V_QTY_SUM FROM XX_SALES WHERE XDATE >= V_DATE_FROM AND XDATE <= V_DATE_TO; DBMS_OUTPUT.PUT_LINE(TO_CHAR(V_DATE_FROM, 'YYYYMMDD') || '-----qty: ' || TO_CHAR(V_QTY_SUM)); END IF; END LOOP; END;
Thanks in advance,
Best regards
Zhxiang
Published by: zhxiangxie on April 26, 2012 14:41 fixed the grouping expected dataThere was an article about a similar problem in Oracle Magazine recently:
http://www.Oracle.com/technetwork/issue-archive/2012/12-Mar/o22asktom-1518271.html
See the section on the 'grouping beaches '. They needed a total cumulative who started once the total reaches a certain amount.
You need a total cumulative which starts again when the date changes to group and the dates of beginning and end of each group must be determined dynamically.
This can be done with the analytical functions.
Here is a solution-based 'code listing 5', the solution MODEL, which is recommended in the article.
SELECT FIRST_DATE, SUM(XQTY) SUM_XQTY FROM ( SELECT * FROM xx_sales MODEL DIMENSION BY(ROW_NUMBER() OVER(ORDER BY XDATE) RN) MEASURES(XDATE, XDATE FIRST_DATE, XQTY) RULES( FIRST_DATE[RN > 1] = CASE WHEN XDATE[CV()] - FIRST_DATE[CV() - 1] >= 3 THEN xdate[cv()] ELSE FIRST_DATE[CV() - 1] END ) ) GROUP BY first_date ORDER BY first_date; FIRST_DATE SUM_XQTY --------------------- -------- 2012/05/01 00:00:00 60 2012/05/04 00:00:00 60 2012/05/07 00:00:00 80 2012/05/12 00:00:00 155 2012/05/15 00:00:00 99
If you 9i, there is no function model. In this case, I can give you a solution using START WITH / CONNECT BY that does not work as well.
Maybe you are looking for
-
How to disable an add-in to always open a new tab to a predetermined web page?
Research of duct add on sneaking on my firefox when I downloaded a free comic reader called "CDisplay. I tried to use the cleaning https://addons.mozilla.org/en-US/firefox/addon/searchreset/ add-on, but it is nowhere once it has apparently installed.
-
I have an iphone4S and full sound. I deleted all the applications that I don't use and don't have any music on it. How can I find out which takes all of my space? Thank you
-
I have lost my windows xp installation on my computer dell laptop, but I printed on my laptop product key, how to install it again.
-
lock the mouse button does not work
It worked fine until a few weeks ago. Now, I need to left-click while using the touch of the finger. I'm going to: mouse properties, buttons, lock, turn on click-lock and ok. It does not help. Thank you.
-
Please tell us how correect this application opdd after years saying all of a sudden my wondows is not geniue and what to do to fix, I can by pass and everything works fine