Need help in solving Linked lists queries
I have encountered this code
part a
Node head, tail;
head = null;
tail = null;
head = new Node("Beef", head); //what does that mean?part b
Node head, tail;
head = null;
tail = null;
node new 3 = new Node("Pork");
tail.next = new3;
tail = new3;I am told to use diagrams to show the results of these codes. How to go about solving it?
part aWhat do you think? You can see that it creates a node, and it assigns the new node to head.
part bSame applies here. What do you think it does? You can see that it creates a new node, and uses the tail variable.
Try draw it all on a paper.
Similar Messages
-
I need help with circular linked list
Hi,
I need help with my code. when I run it I only get the 3 showing and this is what Im supposed to ouput
-> 9 -> 3 -> 7
empty false
9
empty false
3
-> 7
empty false
Can someone take a look at it and tell me what I'm doing wrong. I could nto figure it out.
Thanks.This is my code
/ A circular linked list class with a dummy tail
public class CLL{
CLLNode tail;
public CLL( ){
tail = new CLLNode(0,null); // node to be dummy tail
tail.next = tail;
public String toString( ){
// fill this in. It should print in a format like
// -> 3 -> 5 -> 7
if(tail==null)return "( )";
CLLNode temp = tail.next;
String retval = "-> ";
for(int i = 0; i < -999; i++)
do{
retval = (retval + temp.toString() + " ");
temp = temp.next;
}while(temp!=tail.next);
retval+= "";}
return retval;
public boolean isEmpty( ){
// fill in here
if(tail.next == null)
return true;
else{
return false;
// insert Token tok at end of list. Old dummy becomes last real node
// and new dummy created
public void addAtTail(int num){
// fill in here
if (tail == null)
tail.data = num;
else
CLLNode n = new CLLNode(num, null);
n.next = tail.next;
tail.next = n;
tail = n;
public void addAtHead(int num){
// fill in here
if(tail == null)
CLLNode l = new CLLNode(num, null);
l.next = tail;
tail =l;
if(tail!=null)
CLLNode l = new CLLNode(num, null);
tail.next = l;
l.next = tail;
tail = l;
public int removeHead( ){
// fill in here
int num;
if(tail.next!= null)
tail = tail.next.next;
//removeHead(tail.next);
tail.next.next = tail.next;
return tail.next.data;
public static void main(String args[ ]){
CLL cll = new CLL ( );
cll.addAtTail(9);
cll.addAtTail(3);
cll.addAtTail(7);
System.out.println(cll);
System.out.println("empty " + cll.isEmpty( ));
System.out.println(cll.removeHead( ));
System.out.println("empty " + cll.isEmpty( ));
System.out.println(cll.removeHead( ));
System.out.println(cll);
System.out.println("empty " + cll.isEmpty( ));
class CLLNode{
int data;
CLLNode next;
public CLLNode(int dta, CLLNode nxt){
data = dta;
next = nxt;
}I'm not going thru all the code to just "fix it for you". But I do see one glaringly obvious mistake:
for(int i = 0; i < -999; i++)That says:
1) Initialize i to 0
2) while i is less than -999, do something
Since it is initially 0, it will never enter that loop body. -
Hi i need help with my linked list
hello
im having trouble with my list
this is where i create the studentlinked list. within my constructor for my college.
public class MyCollege {
private int capacity;
public MyCollege(){
StudentLinkedList studentList = new StudentLinkedList();
}now my problem is in my add student method
here it is.
at the end of the method where i add the student to the linked list (studentList.add(aStudent);)is my problem. it says that studentList cannot be resolved.
i understand that it cant find studentList. but i am creating it.
why isnt it working???????????????????
public static void main(String[] args) {
MyCollege mc1 = new MyCollege();
public void addStudent(int i){
try{
Student aStudent = new Student();
String name,studentNumber, programmeCode;
int yearBegan;
if(i < capacity){
// this defines the buffer that will hold the data to be input
BufferedReader theDataStream;
theDataStream = new BufferedReader(new InputStreamReader(System.in));
//enter the details of the student
System.out.println("Enter in the name of the student followed by their student number");
System.out.println("followed by the year they began in the college a and then the course code");
System.out.println(" hit enter after each one");
name = theDataStream.readLine();
studentNumber = theDataStream.readLine();
yearBegan = Integer.parseInt(theDataStream.readLine());
programmeCode = theDataStream.readLine();
aStudent.setName(name);
aStudent.setStudentNumber(studentNumber);
aStudent.setYearBegan(yearBegan);
aStudent.setProgrammeCode(programmeCode);
studentList.add(aStudent);
}//end if
}//end try
catch(IOException e) {
System.out.println(e.getMessage());
}cheers got it striaght away
private int capacity;
private StudentLinkedList studentList;
-
Need Help In Solving Positioning Problem
Hi Guys,
I have a 3 X 3 grid of JLabels of images. I constructed the grid using the grid layout.
I would like to move a round object which represents a car and place that object in a particular cell. So the grid will be like a background.
My questions are these:
1) How can i position this object in a specific cell based on the rows and column values? for instance if i want to put the object in [1][0].
2) How do i move this object to a different cell using the rows and column values. for instance if i want to move the object in [1][0] to [2][1]
Thank you all for your helpThis question has nothing to do with Java 2D. I've removed the second thread you started in that forum.
Thank you for providing a link to this thread in the cross post.
db
kap wrote:
Hi Guys,
I have posted a question in the Java Programming forum. This is the link :
[positioning object|http://forums.sun.com/thread.jspa?threadID=5447680&tstart=0]
I added the link to avoid double posts
I am asking if someone can help me out because i need an urgent help. Some people have giving some ideas but i don't understand what they mean.
Need help in solving it.
Thanks.
Edited by: kap on Aug 14, 2010 6:59 PM -
Need Help In Solving Writing To Queue Problem
Hi Guys,
I have two threads that are adding to the same message queue. The first one is suppose to add four integers consecutively. Meanwhile the second thread add an integer in between the four integers. Because of that my application is not working properly. I would like that when a thread is adding then the other must wait before it adds. The method that the threads call to add to the queue are all synchronized, but it is still behaving like that.
I need help in solving it.
Thanks.
Edited by: kap on Aug 9, 2010 5:22 AMkap wrote:
Please what do you mean by synchronizing on the same object? Can you explain it to me?
When you synchronize a block of Java code, you synchronize on a particular object, which is called the Monitor.
The effect is only to prevent another thread running this, or another block of code synchronized on the same object.
If you use synchronized methods, then the monitor is the object to which the method belongs (or the class if the method is static). The same synchronized method can be executed simultaneously on a different instance of the object. -
Need help in solving java.io.NotSerializableException
Hi,
Weblogic 9.2
I need help in solving the java.io.NotSerializableException: weblogic.jndi.internal.ApplicationNamingNode
I dont know why ApplicationNamingNode has to be serialized.
Full stack trace will be provided if needed.
thank youHere is the stack trace
Remote service [com.gfs.corp.component.price.customerbid.PCBMaint] threw exception
weblogic.rjvm.PeerGoneException: ; nested exception is:
java.rmi.UnmarshalException: Incoming message header or abbreviation processing failed ; nested exception is:
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: weblogic.jndi.internal.ApplicationNamingNode
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:211)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:338)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:252)
at com.gfs.corp.component.price.maint.customerbid.ejb.PCBMaint_q9igfc_EOImpl_922_WLStub.createBid(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.springframework.remoting.rmi.RmiClientInterceptorUtils.doInvoke(RmiClientInterceptorUtils.java:107)
at org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.doInvoke(SimpleRemoteSlsbInvokerInterceptor.java:75)
at org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.invoke(AbstractRemoteSlsbInvokerInterceptor.java:119)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy47.createBid(Unknown Source)
at com.gfs.corp.bid.price.controller.DefaultBidPriceUpdater.awardBid(DefaultBidPriceUpdater.java:83)
at com.gfs.corp.bid.price.ejb.AwardQueueMessageHandler.onMessage(AwardQueueMessageHandler.java:98)
at weblogic.ejb.container.internal.MDListener.execute(MDListener.java:429)
at weblogic.ejb.container.internal.MDListener.transactionalOnMessage(MDListener.java:335)
at weblogic.ejb.container.internal.MDListener.onMessage(MDListener.java:291)
at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:4072)
at weblogic.jms.client.JMSSession.execute(JMSSession.java:3962)
at weblogic.jms.client.JMSSession$UseForRunnable.run(JMSSession.java:4490)
at weblogic.work.ServerWorkManagerImpl$WorkAdapterImpl.run(ServerWorkManagerImpl.java:518)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
Caused by: java.rmi.UnmarshalException: Incoming message header or abbreviation processing failed ; nested exception is:
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: weblogic.jndi.internal.ApplicationNamingNode
at weblogic.rjvm.MsgAbbrevJVMConnection.dispatch(MsgAbbrevJVMConnection.java:441)
at weblogic.rjvm.t3.MuxableSocketT3.dispatch(MuxableSocketT3.java:368)
at weblogic.socket.AbstractMuxableSocket.dispatch(AbstractMuxableSocket.java:378)
at weblogic.socket.NTSocketMuxer.processSockets(NTSocketMuxer.java:105)
at weblogic.socket.SocketReaderRequest.run(SocketReaderRequest.java:29)
at weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:42)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:145)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:117)
Caused by: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: weblogic.jndi.internal.ApplicationNamingNode
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1309)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at weblogic.transaction.internal.PropagationContext.readRollbackReason(PropagationContext.java:804)
at weblogic.transaction.internal.PropagationContext.readExternal(PropagationContext.java:376)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1755)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1717)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at weblogic.rmi.provider.BasicServiceContext.readExternal(BasicServiceContext.java:56)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1755)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1717)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:195)
at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:565)
at weblogic.rjvm.MsgAbbrevInputStream.readExtendedContexts(MsgAbbrevInputStream.java:224)
at weblogic.rjvm.MsgAbbrevInputStream.init(MsgAbbrevInputStream.java:188)
at weblogic.rjvm.MsgAbbrevJVMConnection.dispatch(MsgAbbrevJVMConnection.java:435)
... 7 more
Caused by: java.io.NotSerializableException: weblogic.jndi.internal.ApplicationNamingNode
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
at weblogic.jndi.internal.WLContextImpl.writeExternal(WLContextImpl.java:453)
at weblogic.jndi.internal.WLEventContextImpl.writeExternal(WLEventContextImpl.java:422)
at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1310)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1288)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
at weblogic.transaction.internal.PropagationContext.convertRollbackReasonToBytes(PropagationContext.java:735)
at weblogic.transaction.internal.PropagationContext.writeRollbackReason(PropagationContext.java:819)
at weblogic.transaction.internal.PropagationContext.writeExternal(PropagationContext.java:183)
at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1310)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1288)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
at weblogic.rmi.provider.BasicServiceContext.writeExternal(BasicServiceContext.java:48)
at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1310)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1288)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
at weblogic.rjvm.MsgAbbrevOutputStream.writeObject(MsgAbbrevOutputStream.java:614)
at weblogic.rjvm.MsgAbbrevOutputStream.marshalCustomCallData(MsgAbbrevOutputStream.java:319)
at weblogic.rjvm.MsgAbbrevOutputStream.transferThreadLocalContext(MsgAbbrevOutputStream.java:149)
at weblogic.rmi.internal.BasicServerRef.postInvoke(BasicServerRef.java:606)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:455)
at weblogic.rmi.internal.BasicServerRef.access$300(BasicServerRef.java:58)
at weblogic.rmi.internal.BasicServerRef$BasicExecuteRequest.run(BasicServerRef.java:975)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
2007-10-18 08:38:04,931 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] WARN org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean - Could not invoke 'remove' on remote EJB proxy
weblogic.rjvm.PeerGoneException: ; nested exception is:
java.rmi.UnmarshalException: Incoming message header or abbreviation processing failed ; nested exception is:
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: weblogic.jndi.internal.ApplicationNamingNode
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:211)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:338)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:252)
at com.gfs.corp.component.price.maint.customerbid.ejb.PCBMaint_q9igfc_EOImpl_922_WLStub.remove(Unknown Source)
at org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.removeSessionBeanInstance(AbstractRemoteSlsbInvokerInterceptor.java:227)
at org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.releaseSessionBeanInstance(SimpleRemoteSlsbInvokerInterceptor.java:118)
at org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.doInvoke(SimpleRemoteSlsbInvokerInterceptor.java:95)
at org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.invoke(AbstractRemoteSlsbInvokerInterceptor.java:119)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy47.createBid(Unknown Source)
at com.gfs.corp.bid.price.controller.DefaultBidPriceUpdater.awardBid(DefaultBidPriceUpdater.java:83)
at com.gfs.corp.bid.price.ejb.AwardQueueMessageHandler.onMessage(AwardQueueMessageHandler.java:98)
at weblogic.ejb.container.internal.MDListener.execute(MDListener.java:429)
at weblogic.ejb.container.internal.MDListener.transactionalOnMessage(MDListener.java:335)
at weblogic.ejb.container.internal.MDListener.onMessage(MDListener.java:291)
at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:4072)
at weblogic.jms.client.JMSSession.execute(JMSSession.java:3962)
at weblogic.jms.client.JMSSession$UseForRunnable.run(JMSSession.java:4490)
at weblogic.work.ServerWorkManagerImpl$WorkAdapterImpl.run(ServerWorkManagerImpl.java:518)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
Caused by: java.rmi.UnmarshalException: Incoming message header or abbreviation processing failed ; nested exception is:
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: weblogic.jndi.internal.ApplicationNamingNode
at weblogic.rjvm.MsgAbbrevJVMConnection.dispatch(MsgAbbrevJVMConnection.java:441)
at weblogic.rjvm.t3.MuxableSocketT3.dispatch(MuxableSocketT3.java:368)
at weblogic.socket.AbstractMuxableSocket.dispatch(AbstractMuxableSocket.java:378)
at weblogic.socket.NTSocketMuxer.processSockets(NTSocketMuxer.java:105)
at weblogic.socket.SocketReaderRequest.run(SocketReaderRequest.java:29)
at weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:42)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:145)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:117)
Caused by: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: weblogic.jndi.internal.ApplicationNamingNode
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1309)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at weblogic.transaction.internal.PropagationContext.readRollbackReason(PropagationContext.java:804)
at weblogic.transaction.internal.PropagationContext.readExternal(PropagationContext.java:376)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1755)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1717)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at weblogic.rmi.provider.BasicServiceContext.readExternal(BasicServiceContext.java:56)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1755)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1717)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:195)
at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:565)
at weblogic.rjvm.MsgAbbrevInputStream.readExtendedContexts(MsgAbbrevInputStream.java:224)
at weblogic.rjvm.MsgAbbrevInputStream.init(MsgAbbrevInputStream.java:188)
at weblogic.rjvm.MsgAbbrevJVMConnection.dispatch(MsgAbbrevJVMConnection.java:435)
... 7 more
Caused by: java.io.NotSerializableException: weblogic.jndi.internal.ApplicationNamingNode
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
at weblogic.jndi.internal.WLContextImpl.writeExternal(WLContextImpl.java:453)
at weblogic.jndi.internal.WLEventContextImpl.writeExternal(WLEventContextImpl.java:422)
at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1310)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1288)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1375)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1347)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1290)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
at weblogic.transaction.internal.PropagationContext.convertRollbackReasonToBytes(PropagationContext.java:735)
at weblogic.transaction.internal.PropagationContext.writeRollbackReason(PropagationContext.java:819)
at weblogic.transaction.internal.PropagationContext.writeExternal(PropagationContext.java:183)
at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1310)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1288)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
at weblogic.rmi.provider.BasicServiceContext.writeExternal(BasicServiceContext.java:48)
at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1310)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1288)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1079)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
at weblogic.rjvm.MsgAbbrevOutputStream.writeObject(MsgAbbrevOutputStream.java:614)
at weblogic.rjvm.MsgAbbrevOutputStream.marshalCustomCallData(MsgAbbrevOutputStream.java:319)
at weblogic.rjvm.MsgAbbrevOutputStream.transferThreadLocalContext(MsgAbbrevOutputStream.java:149)
at weblogic.rmi.internal.ReplyOnError.run(ReplyOnError.java:54)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
2007-10-18 08:38:05,244 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] DEBUG org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean - Could not connect to remote EJB [com.gfs.corp.component.price.customerbid.PCBMaint] - retrying
org.springframework.remoting.RemoteConnectFailureException: Could not connect to remote service [com.gfs.corp.component.price.customerbid.PCBMaint]; nested exception is weblogic.rjvm.PeerGoneException: ; nested exception is:
java.rmi.UnmarshalException: Incoming message header or abbreviation processing failed ; nested exception is:
java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: weblogic.jndi.internal.ApplicationNamingNode
thank you -
Need help with drop down list in parameters
Hi All,
I have the following data set:
DEPT1 DEPT2 DEPT3 DEPT4
Commissioner's Office Finance Accounting Accounts Payable
Commissioner's Office Finance Accounting Fiscal Analysis & Repo
Commissioner's Office Finance Accounting
Commissioner's Office Planning,Asset Mgt Asset Management Inventory & Tracking
Commissioner's Office Planning,Asset Mgt Asset Management Mobility & Congestion
Commissioner's Office Planning,Asset Mgt Asset Management Roadway Safety
Commissioner's Office Planning,Asset Mgt Asset Management
Commissioner's Office DesignProj Mgt & Tec Bridge Dsgn Insp Hyd
In plus i have four parameters with searchlight options, the problem is when i select "Finance" from DEPT2 and in the next selection level i'm seeing all the departments "Accounting,Asset Management and Bridge Dsgn Insp Hyd" insted of just "Accounting". What i want is if i select a department in DEPT2, in the next drop down list(DEPT3) i want to see only the departement corresponding to the one i selected in dept2. Please need help.
ThanksHi
First of all you need to be using Discoverer 10g or 11g Plus not 9.0.4. Assuming you have the right version you need to present the parameters in the correct order. You can change the order on the parameters screen by selecting Tools | Parameters from the toolbar. You then use the Move Up and Move Down buttons to place them in the right order so that DEPT1 is offered first, followed by DEPT2, then DEPT3 and then DEPT4.
Next, you need to check the radion button on the bottom of the right-hand side that allows linking of parameters then you make DEPT2 dependent upon DEPT1, with DEPT3 dependent upon DEPT2 and so on.
While this works without hierarchies it works best when you have a hierarchy in place and even better when there is a composite index on the 4 items.
Best wishes
Michael -
Help with Library link lists ..
Hi ,
I am working with Scott Mazur on a incorporating 8.1.7 in our code bace for our next product release. I am having problems with defining the library link list needed for builds. In the documentation it makes referance to $ORACLE_HOME/precomp/demo/proc which I cannot find. I have installed the 8.1.7 on 3 platforms (Solaris, AIX and NT ) and none of the system have this information. Can you please point me to where I may find some help in this area. We are in a critical path right now so I would appreciate any help you could give me. The sooner the better.
Thank you for your time and help ,
Cheryl Pollock
Lockheed Martin Global Telecommunications .
Formtek
Pittsburgh office .
(412) 937-4970
nullYou actually shouldn't try to get the library link lists directly. Rather, you should use the $ORACLE_HOME/rdbms/demo/demo_rdbms.mk makefile like this:
make -f $ORACLE_HOME/rdbms/demo/demo_rdbms.mk build EXE=yourexecutable OBJS="object list"
where yourexecutable is the name for your executable and the OBJS= includes a quoted list of all your object and library files.
null -
I NEED HELP TO SOLVE MY SANDY BRIDGE CHIPSET ISSUE !!!
Hi,
I need help from somebody to receive the updated part for my Pavilion Dv7 4290us !!!.
This is one of the machines affected by the Sandy Bridge issue, I checked many times...
I already registered the Laptop
Thanks in advance
Manuel Ramirez
This question was solved.
View Solution.The product number of your laptop is XZ037UA#ABA (Here ABA means this particular model was sold in US only) . Where was this laptop purchased exactly and Where are you currently located?
HP provides a global warranty and ideally this should be covered at no additional cost. You can find more info at below link
http://h10025.www1.hp.com/ewfrf/wc/document?docname=bpr01266&cc=us&dlc=en&lc=en&jumpid=reg_R1002_USE...
//Click on Kudos and Accept as Solution if my reply was helpful and answered your question//
I am an HP employee!! -
Help PLEASE with linked list. Inserting a string in the middle of
I'm trying to insert new strings to a linked list but it seem i cant never insert. the following code has the instructions. What i'm I not doing right? If i try to use the code, the new strings don't go through
please help someone
// This method should insert a new node containing the string newString immediately after the first
// occurrence of the string aString in the list. If aString is not in the list, the method should add a node
// containing newString to the tail of the list.
public void insertAfter(String newString, String aString)
StringLLNode newNode = new StringLLNode();
newNode.setData(newString);
//Check if HeadNode == aString
if (headNode.getData().equalsIgnoreCase(aString))
headNode = newNode;
//rest of the nodes
StringLLNode currNode = headNode;
while(currNode != null)
if (currNode.getData().equalsIgnoreCase(aString))
newNode.setNext(currNode);
//System.out.println("It went THROUGH");
currNode = currNode.getNext();
//Last Node
if (currNode != null)
newNode.setNext(headNode);
}I have to agree with flounder, go grab a pen and paper and logically work thru the code snippet you posted.
public void insertAfter(String newString, String aString)
StringLLNode newNode = new StringLLNode();
newNode.setData(newString);
//Check if HeadNode == aString
if (headNode.getData().equalsIgnoreCase(aString))
headNode = newNode;
//rest of the nodes
StringLLNode currNode = headNode;
while(currNode != null)
if (currNode.getData().equalsIgnoreCase(aString))
newNode.setNext(currNode);
//System.out.println("It went THROUGH");
currNode = currNode.getNext();
//Last Node
if (currNode != null)
newNode.setNext(headNode);
}Given a linked list [A-E] we have: A => B => C => D => E. Each Node is referencing the node to it's right, so A references B, D references E etc.
For example take aString = "A" and newString = "AB". Your code suggests the following:
1. Create new_node "AB"
2. if head[A] equals aString[A], TRUE
2.a head = new_ node
Now the resulting linkedlist is the following:
AB => Null
what happened to the rest of the list?
Now we go on to your updated example, we result in the following list:
A => AB => Null
hmm do you see a pattern here? when inserting a new node we are disregarding any reference to the tail of the list.
Extending on that idea we have the following pseudo code
1. if node to be inserted
1.a new_node.next = list_tail
1.b current_node.next = new_node
A => B => C => D => E, where newnode=AA
AA => B => C => D => E //using 1.a
A => AA => B => C => D => E //using 1.b
Mel -
Including Help in the Linked List Entries
Hi,
Can any one explain how to include Help text to the Linked List Entries like including normal help in the other APEX 2.2 items?
Thanks
ChitraHi santhosh
while you are creating the fieldcatalog there is a field called 'ROLLNAME' - Data element for F1 help.
If your F1 help is in reference to this data element you can specifiy it here so that it appears on the List viewer. Otherwise you have to create your own data element with the documentation and specify it here for it to appear.
In the Grid control, you can use events for triggering the same.
Hope this helps.
Reward points.
Regards
Meera -
ComboBox (dropdown) Need Help Adding URL links!!!
I am somewhat of a newbie....Anybody know how to use URL
links in a ComboBox dropdown menu? NEED HELP!!!!!!! I'm trying to
make it so that after selecting an option, the user is directed to
another URL within the same browser window. Using flash 8!
Thanks,Im a bit a newbie myslef but i think you make flash
commuincate to javascript wich will make the browser goto the URL.
do a search on getURL and javascript together and i am sure
you will find something.
And when slecting to redirct i think its on?(onPress)
something so maybe look throught the help section in flash 8 and
look at componets. I think there is some actionscript help there.
Sorry i could not be more helpful. -
Help abstract classes linked list
I have a base abstract class Vegetable which is basically Node for a linkedlist
The base class Vegetable has a few abstract methods Pumpkin, Carrot, Potato basically extends Vegetable
Another class called VegetableCollection
basically in VegetableCollection
can this be done if the objects are different types eg Pumpkin, potato, Carrot?
public void add(Vegetable addObject)
head = new Vegetable(addObject);
}I have a base abstract class Vegetable which is basically Node for a linkedlist
The base class Vegetable has a few abstract methods Pumpkin, Carrot, PotatoYou probably wouldn't have abstract methods with those names. Abstract methods are methods that you will need to define in every subclass. And a subclass called Pumpkin probably won't have meaningful definitions for methods called Carrot and Potato.
can this be done if the objects are different types eg Pumpkin, potato, Carrot?
public void add(Vegetable addObject)
head = new Vegetable(addObject);
}Here is an example of "polymorphism" at work:
import java.util.*;
abstract class Vegetable
public abstract void identify();
class Carrot extends Vegetable
public void identify()
System.out.println("I'm a Carrot.");
class Pumpkin extends Vegetable
public void identify()
System.out.println("I'm a Pumpkin.");
public class Test
public static void main(String args[])
LinkedList<Vegetable> myVegetables = new LinkedList<Vegetable>();
myVegetables.add(new Carrot());
myVegetables.add(new Pumpkin());
Iterator<Vegetable> i = myVegetables.iterator();
Vegetable v = null;
while(i.hasNext())
v = i.next();
v.identify();
output:
I'm a Carrot.
I'm a Pumpkin.To get polymorphism to work, you need to:
1) Define a base class with a method that you want in all the subclasses.
2) Override the method in the subclasses so that it does what's necessary for that subclass.
3) Store the subclass objects in a variable(or collection) whose type is the base class.
4) Call the method on the base type variable. Then through the magic of polymorphism, java will examine the actual object stored in the base type variable to determine what subclass it is, and then java will call the version of the method in that subclass.
As the previous poster mentioned, you need to define a class called Node, which has head, previous, and next members. Your Node class will also have a member variable called veggie, which will be of type Vegetable. Then you can assign a Carrot, Pumpkin, or Potato object to that member variable.
I assume this is an exercise where you have to create your own linked list. Otherwise, you can use the linked lists provided by java, which are very easy to use. -
i am getting error as Redo sequence 9165 no longer available in online logs for thread 1 without ... without archiving enabled, SQL <SELECT MAX(sequence#) FROM v$log WHERE thread# = :ora_thread AND status ... 'CURRENT', 'ACTIVE')>, error retrieving redo file name for sequence 16, archived = 1, use_alternate = 0Not
actually it was capturing till a date, but after that extraction has stopped and i see this error,
please can anyone help in solving this issuewill you please elaborate your query? not able to understand.
-
Need help to solve update querry for multiple records.
Could any of you please provide update querry for the following scenario.
Requiremnt:
1. Update the UNIQUE_ID of record ( same Identifier and Identifier_code
where END_Date is not null) with the UNIQUE_ID of the record (( same Identifier and Identifier_code
where END_Date is null).
2. If More than one NULL in END_date then update UNIQUE_ID with max(EFFective_Date) of UNIQUE_ID
Source data
UNIQUE_ID
Identifier
Identifier_code
EFFective_Date
END_Date
1
777
abc
2/14/2014 11:15
2/28/2014 9:00
1
777
abc
2/21/2014 9:00
3/7/2014 9:02
2
777
abc
2/28/2014 9:00
3/14/2014 9:02
2
777
abc
3/7/2014 9:02
3/14/2014 9:02
2
777
abc
3/14/2014 9:02
NULL
5
888
xyz
2/14/2014 11:15
2/28/2014 9:00
5
888
xyz
2/21/2014 9:00
3/7/2014 9:02
5
888
xyz
2/28/2014 9:00
3/14/2014 9:02
6
888
xyz
3/7/2014 9:02
NULL
7
888
xyz
3/14/2014 9:02
NULL
OutPUT .
UNIQUE_ID
Identifier
Identifier_code
EFFective_Date
END_Date
2
777
abc
2/14/2014 11:15
2/28/2014 9:00
2
777
abc
2/21/2014 9:00
3/7/2014 9:02
2
777
abc
2/28/2014 9:00
3/14/2014 9:02
2
777
abc
3/7/2014 9:02
3/14/2014 9:02
2
777
abc
3/14/2014 9:02
NULL
7
888
xyz
2/14/2014 11:15
2/28/2014 9:00
7
888
xyz
2/21/2014 9:00
3/7/2014 9:02
7
888
xyz
2/28/2014 9:00
3/14/2014 9:02
7
888
xyz
3/7/2014 9:02
NULL
7
888
xyz
3/14/2014 9:02
NULL
Thanks in advance.Hi Vikash,
This query will not produce results as per requirement:
Try it with following data
Insert into @TempTABLE values (1,777,'abc','2/14/2014 11:15','3/14/2014 9:02')
Insert into @TempTABLE values (1,777,'abc','2/21/2014 9:00','3/14/2014 9:02')
Insert into @TempTABLE values (2,777,'abc','2/28/2014 9:00','3/14/2014 9:02')
Insert into @TempTABLE values (2,777,'abc','3/7/2014 9:02','3/14/2014 9:02')
Insert into @TempTABLE values (2,777,'abc','3/14/2014 9:02',NULL)
Insert into @TempTABLE values (5,888,'xyz','2/14/2014 11:15','3/14/2014 9:02')
Insert into @TempTABLE values (5,888,'xyz','2/21/2014 9:00','3/14/2014 9:02')
Insert into @TempTABLE values (5,888,'xyz','2/28/2014 9:00','3/14/2014 9:02')
Insert into @TempTABLE values (7,888,'xyz','3/7/2014 9:02',NULL)
Insert into @TempTABLE values (6,888,'xyz','3/14/2014 9:02',NULL)
as per the problem statement, all records having 888,'xyz' should be updated with 6 not 7 as max effective date is associated with 6 not 7.
Ashutosh
Nope.
can you check the original post first. It clearly states output as having 7 as id for all the records with 888,xyz
also your above posted sample data is different from original sample data as you've dates jumpled up for the records with ids 6 and 7
Please see the illustration for original sample data
--sample table for illustration
declare @t table
(UNIQUE_ID int,Identifier int,Identifier_code varchar(100),EFFective_Date datetime ,END_Date datetime)
--populate original sample data
INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (1, 777, N'abc', CAST(0x0000A2D200B964F0 AS DateTime), CAST(0x0000A2E0009450C0 AS DateTime))
INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (1, 777, N'abc', CAST(0x0000A2D9009450C0 AS DateTime), CAST(0x0000A2E70094DD60 AS DateTime))
INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (2, 777, N'abc', CAST(0x0000A2E0009450C0 AS DateTime), CAST(0x0000A2EE0094DD60 AS DateTime))
INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (2, 777, N'abc', CAST(0x0000A2E70094DD60 AS DateTime), CAST(0x0000A2EE0094DD60 AS DateTime))
INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (2, 777, N'abc', CAST(0x0000A2EE0094DD60 AS DateTime), NULL)
INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (5, 888, N'xyz', CAST(0x0000A2D200B964F0 AS DateTime), CAST(0x0000A2E0009450C0 AS DateTime))
INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (5, 888, N'xyz', CAST(0x0000A2D9009450C0 AS DateTime), CAST(0x0000A2E70094DD60 AS DateTime))
INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (5, 888, N'xyz', CAST(0x0000A2E0009450C0 AS DateTime), CAST(0x0000A2EE0094DD60 AS DateTime))
INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (6, 888, N'xyz', CAST(0x0000A2E70094DD60 AS DateTime), NULL)
INSERT @t ([UNIQUE_ID], [Identifier], [Identifier_code], [EFFective_Date], [END_Date]) VALUES (7, 888, N'xyz', CAST(0x0000A2EE0094DD60 AS DateTime), NULL)
--do the update
UPDATE t
SET UNIQUE_ID = MaxID
FROM
SELECT MAX(CASE WHEN END_DATE IS NULL THEN UNIQUE_ID END) OVER (PARTITION BY Identifier,Identifier_code) AS MaxID,UNIQUE_ID
FROM @t
)t
WHERE UNIQUE_ID <> MaxID
AND MaxID IS NOT NULL
--now check the output
SELECT * FROM @t
The output is as below
UNIQUE_ID Identifier Identifier_code EFFective_Date END_Date
2 777 abc 2014-02-14 11:15:00.000 2014-02-28 09:00:00.000
2 777 abc 2014-02-21 09:00:00.000 2014-03-07 09:02:00.000
2 777 abc 2014-02-28 09:00:00.000 2014-03-14 09:02:00.000
2 777 abc 2014-03-07 09:02:00.000 2014-03-14 09:02:00.000
2 777 abc 2014-03-14 09:02:00.000 NULL
7 888 xyz 2014-02-14 11:15:00.000 2014-02-28 09:00:00.000
7 888 xyz 2014-02-21 09:00:00.000 2014-03-07 09:02:00.000
7 888 xyz 2014-02-28 09:00:00.000 2014-03-14 09:02:00.000
7 888 xyz 2014-03-07 09:02:00.000 NULL
7 888 xyz 2014-03-14 09:02:00.000 NULL
Now compare it with original output and you'll find they're the same
UNIQUE_ID Identifier Identifier_code EFFective_Date END_Date
2 777 abc 2/14/2014 11:15 2/28/2014 9:00
2 777 abc 2/21/2014 9:00 3/7/2014 9:02
2 777 abc 2/28/2014 9:00 3/14/2014 9:02
2 777 abc 3/7/2014 9:02 3/14/2014 9:02
2 777 abc 3/14/2014 9:02 NULL
7 888 xyz 2/14/2014 11:15 2/28/2014 9:00
7 888 xyz 2/21/2014 9:00 3/7/2014 9:02
7 888 xyz 2/28/2014 9:00 3/14/2014 9:02
7 888 xyz 3/7/2014 9:02 NULL
7 888 xyz 3/14/2014 9:02 NULL
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs
Maybe you are looking for
-
My ipod touch is not recognized on itunes and will not turn on or even give me the battery sign that it is dead. I turned it off and it won't turn back on now. The screen is completely black and won't do anything. I have tried charging it over night
-
Windows Media Player in iTunes
I am wondering if there's a way for me to access in/through iTunes radio stations which offer their online streams in WMP only. Can I add stations to my current iTunes list of radios? Thanks so much.
-
I used to play web based flash game, and could open up to 5 different browsers (with the same game) each time with my old notebook 1.8GHz + 4G RAM (Win 7). However, changing to my new macbook pro 13.3 2.8GHz + 8G RAM (OSX Lion), even opening the same
-
An app or two won't flip easily
In a couple of apps flipping from vertical to horizontal does not work that easily while others it works fine. The main one that's an issue is lynda.com app, it takes around 20 seconds to make it move at all. Could that be a software issue in app or
-
Workflow and autonomous transactions
I am trying to implement Workflow to execute PL/SQL procedures that are currently executed manually on my project. Most of the procedures issue commits or rollbacks and per Oracle support I needed to use PRAGMA AUTONOMOUS_TRANSACTION in the Workflow