Not Sure why this is not working
hi all,
Version details :
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
"CORE 11.2.0.2.0 Production"
TNS for Solaris: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
Select * From Dual
Where 'A' In (Decode( 'A','A','''A'''
||','
||'''B''','C','C'));
Result :
no rows
Select * From Dual
Where 'C' In (Decode( 'C','A','''A'''
||','
||'''B''','C','C'));
Result :
Dummy
XPlease let me know why this is working like this ..
Problem:
When the input is 'A' then condition should be 'A' in ('A','B')
When the input is 'C' then condition should be 'C' in ('C')
Thanks,
P Prakash
Edited by: prakash on Feb 4, 2013 10:41 PM
Your first query
Select * From Dual Where 'A' In (Decode( 'A','A','''A'''||','||'''B''','C','C'));This would be evalueated like this
select * from dual where 'A' = '''A'''||','||'''B'''And your second query
Select * From Dual Where 'C' In (Decode( 'C','A','''A'''||','||'''B''','C','C'));Thiw would be evaluated like this
select * from dual where 'C' = 'C'You cannot pass value for IN operater as comma seperated string. The entire string will be passed as a single value. Each value in an in operator is a seperate variable and need to be passed sperately.
select * from dual where 'A' in ('A', 'B') is not the same as
select * from dual where 'A' in ('''A'''||','||'''B''')
Similar Messages
-
Not sure why this didn't work properly.
So I programmed out a clock for practice/educational value for myself, and I got it near the end and encountered a problem. My program has 2 sets of class fields and a few temporary ones. The first set of class fields are text fields (hours, mins, secs) and the second set are Integers (h, m, s) (not int's ... Integers). I have two methods (setText and setTime) that convert between these two sets. setText sets the text fields to whatever time is stored in the Integers, and setTime sets the Integer values to whatever is stored in the text fields (assuming they're valid ints, of course).
The code that was behaving strangely is shown below between the large comment lines. I needed some way to update the time, so I first tried changing the Integer values and then calling setText() ... but it didn't work. So I then tried setting the text fields and calling setTime() and that DID work. The end result of both should be the same, and yet it wasn't. I was wondering why not? Can anyone help/explain?
I figure it has something to do with Integers and mutability, but that doesn't seem likely since they're both declared at the class-level and not within a method. I did some debugging of it (added System.out.println messages) and found out that the Integer value was changing, but then it was being reset back to what it was initially. bleh - I think I'm doing a bad job of explaining it. Anyway - here's the entire code below. It works correctly currently. But I left the bit of code in that wasn't working properly - just commented out. If you uncomment those and comment the 4 lines above them, you'll hopefully see what I'm talking about.
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Line2D;
import java.util.Calendar;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.Timer;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
// Math.sin, Math.cos, Math.tan use RADIANS .. not degrees.
// 0 rad/deg is at east and proceeds clockwise for increasing angle
public class myClock extends JFrame implements ActionListener, DocumentListener
JTextField hours;
JTextField mins;
JTextField secs;
Calendar now;
ClockPane clock = new ClockPane();
JPanel textPane;
Integer m; double mrad;
Integer h; double hrad;
Integer s; double srad;
myClock()
setSize(300,360);
setResizable(false);
setTitle("Clock!");
// get starting time
now = Calendar.getInstance();
hours = new JTextField(String.valueOf(now.get(Calendar.HOUR)%12), 2);
mins = new JTextField(String.valueOf(now.get(Calendar.MINUTE)), 2);
secs = new JTextField(String.valueOf(now.get(Calendar.SECOND)), 2);
setTime();
// set the document listeners
hours.getDocument().addDocumentListener(this);
mins.getDocument().addDocumentListener(this);
secs.getDocument().addDocumentListener(this);
// create visual layout of frame
textPane = createSouthPane();
add(textPane, BorderLayout.SOUTH);
add(clock, BorderLayout.CENTER);
// start clock update timer - updates every second (1000 milliseconds)
new Timer(1000, this).start();
public static void main(String[] args)
myClock app = new myClock();
app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
app.setVisible(true);
class ClockPane extends JPanel
public void paintComponent(Graphics g)
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
Dimension dim = getSize();
double midx = dim.width / 2;
double midy = dim.height / 2;
Ellipse2D e = new Ellipse2D.Double(midx - 140, midy - 140, 280, 280);
g2.draw(e);
srad = s.doubleValue() / 60 * 2 * Math.PI;
mrad = m.doubleValue() / 60 * 2 * Math.PI;
mrad = mrad + srad / 60;
hrad = h.doubleValue() / 12 * 2 * Math.PI;
hrad = hrad + mrad / 12 + srad / 720;
srad = srad - Math.PI / 2;
mrad = mrad - Math.PI / 2;
hrad = hrad - Math.PI / 2;
Line2D shand = new Line2D.Double(midx, midy, midx + (e.getWidth() / 2 - 10) * Math.cos(srad), midy + (e.getHeight() / 2 - 10) * Math.sin(srad));
Line2D mhand = new Line2D.Double(midx, midy, midx + (e.getWidth() / 2 - 10) * Math.cos(mrad), midy + (e.getHeight() / 2 - 10) * Math.sin(mrad));
Line2D hhand = new Line2D.Double(midx, midy, midx + (e.getWidth() / 2 - 40) * Math.cos(hrad), midy + (e.getHeight() / 2 - 40) * Math.sin(hrad));
g2.setPaint(Color.BLACK);
g2.draw(hhand);
g2.draw(mhand);
g2.setPaint(Color.RED);
g2.draw(shand);
private JPanel createSouthPane()
JPanel p = new JPanel();
p.add(new JLabel("Hours:"));
p.add(hours);
p.add(new JLabel("Mins:"));
p.add(mins);
p.add(new JLabel("Secs:"));
p.add(secs);
return p;
// sets the Integer values of h, m, s to what the text fields read
private void setTime()
h = new Integer(hours.getText());
m = new Integer(mins.getText());
s = new Integer(secs.getText());
// sets the text fields hours, mins, secs to what the Integer values contain
private void setText()
hours.setText(String.valueOf(h.intValue()));
mins.setText(String.valueOf(m.intValue()));
secs.setText(String.valueOf(s.intValue()));
// action listener for Timer
public void actionPerformed(ActionEvent e)
int ss = s.intValue();
int mm = m.intValue();
int hh = h.intValue();
ss++;
mm = mm + ss / 60;
hh = hh + mm / 60;
ss = ss % 60;
mm = mm % 60;
hh = hh % 12;
hours.setText(String.valueOf(hh));
mins.setText(String.valueOf(mm));
secs.setText(String.valueOf(ss));
setTime();
// s = new Integer(ss);
// m = new Integer(mm);
// h = new Integer(hh);
// setText();
clock.repaint();
// document listener for text fields
public void changedUpdate(DocumentEvent e)
if (mins.getText().equals("") || hours.getText().equals("") || secs.getText().equals("")) ;
else
setTime();
clock.repaint();
public void removeUpdate(DocumentEvent e)
if (mins.getText().equals("") || hours.getText().equals("") || secs.getText().equals("")) ;
else
setTime();
clock.repaint();
public void insertUpdate(DocumentEvent e)
if (mins.getText().equals("") || hours.getText().equals("") || secs.getText().equals("")) ;
else
setTime();
clock.repaint();
}What does reading the text fields have to do with
setting the text fields? You can set their values to
anything you want. Look up MVC, which stands for
model-view-controller. The text fields should only be
used to display information from the model, which is
a Calendar. The controller is the timer which updates
the view with data from the model every second. I think you need to re-read everything that I've said up to now...
It started out the program WITHOUT a timer, where the user would type in some numbers in the text fields and the time the clock displayed would change to match what they typed in. I wanted to keep this behavior simply because I wanted to. I wasn't attempting to make an actual authentic clock. After I had the program working, then I wanted to enhance it so that it altered itself, as well as the user still being able to alter it. I suppose if I were going to program it again from scratch, I'd probably have the clock have some int's at the class level and use those to make the text fields and such. Anyway --- this program is not (and never has been) about keeping accurate time.
Creating a new object once a second isn't a big deal.
If you depend on the Timer frequency to keep time, it
will eventually drift and be inaccurate. Getting the
system time each update will prevent that. You're
updating the view based on the model, then updating
the model based on the view's values, then updating
the model. It's a much cleaner design to separate
those parts clearly. Since this is for your own
education you ought to start using good design
patterns. I know they drift apart. That's not what I was interested in. And, afaik, "good design patterns" come with experience ... which is something that takes time to build and something that I am gaining. I'm not looking for a critique of my code here - I'm looking for a simple answer of why one approach worked properly and one didn't.
Can you be more desciptive than "behaving strangely"?
What's happening?Did you read my original post?
One approach -> change the int's first, then update the fields.
another approach -> change the fields first, then update the int's.
One worked, one didn't. -
Hi all,
I'm trying to make a button which scales up on rollover and
scales down on rollout and I wanted to use the Tween class to do it
because I'm going to be making a bunch of these buttons and I want
the code to be as efficient as possible.
So right now I have a circle in a movie clip, and here's what
I have on the first frame of that circle's actions layer:
import mx.transitions.Tween;
import mx.transitions.easing.*;
function grow(who) {
var tw:Tween = new Tween(who, "_xscale", Strong.easeOut,
100, 400, 1, true);
var tw2:Tween = new Tween(who, "_yscale", Strong.easeOut,
100, 400, 1, true);
function shrink(who) {
var tw3:Tween = new Tween(who, "_xscale", Strong.easeOut,
400, 100, 1, true);
var tw4:Tween = new Tween(who, "_yscale", Strong.easeOut,
400, 100, 1, true);
this.onEnterFrame = function() {
trace(rewind);
if (rewind == true) {
shrink(this);
this.onRollOver = function() {
rewind = false;
grow(this);
this.onRollOut = function() {
rewind = true;
The circle scales up just fine but when I rollout it doesn't
scale back down. I did a trace to see if my tween was being called
and sure enough it was. So I did another trace to see if the
_xscale or _yscale was changing and they both were going down to
around 290 on rollOut although there's no noticeable difference in
the size of the button, it just looks like it's sitting there.
I was also wondering if importing the whole class library
will add very much to my file size?
Also, since I'm going to have a lot of these buttons on the
stage at the same time (these buttons will be like markers all over
a map so there'll probably be around 50+) would it be a bad idea to
have that many onEnterFrame checks running simultaneously? Is that
going to slow the user's CPU way down?Thanks for the suggestions guys.
I tried your code and got the rollOut to work but the button
blinks rapidly if the user rolls out and then rolls back in
quickly. Here is a link to the swf:
http://www.stationarynotes.com/studioI/buttonTest.swf
It also has to reach a complete stop the first time the
button expands or else it won't run the shrink function on rollOut.
I put all of my code on the first frame of the movie clip's
actions layer so here's what mine looks like:
import mx.transitions.Tween;
import mx.transitions.easing.*;
function grow(who) {
var tw:Tween = new Tween(who, "_xscale", Strong.easeOut,
100, 400, 1, true);
var tw2:Tween = new Tween(who, "_yscale", Strong.easeOut,
100, 400, 1, true);
tw.onMotionFinished=function():Void{
who.onRollOut = function() {
shrink(who);
function shrink(who) {
var tw3:Tween = new Tween(who, "_xscale", Strong.easeOut,
400, 100, 1, true);
var tw4:Tween = new Tween(who, "_yscale", Strong.easeOut,
400, 100, 1, true);
this.onRollOver = function() {
grow(this); -
Not sure why Message is not working on my ipad.
Not sure why message is not work on my iPad. It works find on my iPhone.
http://support.apple.com/kb/TS2755
-
I have $10.60 in my ITunes account. I tried to download a bok for $9.99 but keep getting the message that I have insufficient funds for purchase and am redirected to the billing page. Not sure why this is happening....is there tax on the books?
Yes, there is applicable tax charged on all purchases.
-
emails in my 'trash' are being deleted after about 5 weeks, but I want to retain them. I have selected 'never' on the 'permanently erase deleted messages' option, so I'm not sure why this happening? any ideas?
iCloud emails in the Trash are deleted after 30 days on the website, and this over-rides the 'never' setting in Mail. There is no way of stopping this. (The Trash isn't really intended as a permanent storage area.)
Try this workaround. Go to http://www.icloud.com and go to the Mail page. In the sidebar, click on '+' to the right of 'Folders' to create a new folder; give it a suitable name.
Now click on the cogwheel icon at bottom left. At the bottom of the pane which opens, set the 'Move deleted messages to' drop-down menu to your new folder.
I'm not sure whether, when you delete messages in the Mail application, they will go to the Trash or your new folder - you'll need to experiment. I have a nasty feeling that Mail will simply move them to the Trash as before. If this is the case you will have to move them to your new folder manually - dragging messages directly to this folder rather than hitting the delete key will be the easiest way. -
iPhoto is no longer allowing me to export & resize photos into a file on my desktop. It just states that it is Unable to create file on desktop. I'm not sure what this means on how to correct this issue. Any support would be greatly appreciated!
Then do the following:
Fix #1
Launch iPhoto with the Command+Option keys held down and rebuild the library.
Select the options identified in the screenshot.
If Fix #1 fails to help continue with:
Fix #2
Using iPhoto Library Manager to Rebuild Your iPhoto Library
Download IPhoto Library Manager 4 for OS XC 10.6.8 and iPhoto 8.1.2 and later or iPhoto Library Manager 3 (for OS X 10.5.8 and iPhoto 7.1.5 and earlier) and launch.
Click on the Add Library button, navigate to your Home/Pictures folder and select your iPhoto Library folder.
Now that the library is listed in the left hand pane of iPLM, click on your library and go to the File ➙ Rebuild Library menu (iPLM 3) or Library ➙ Rebuild Library menu (iPLM 4) option.
In the next window name the new library and select the location you want it to be placed.
Click on the Create button.
Note: This creates a new library based on the LIbraryData.xml file in the library and will recover Events, Albums, keywords, titles and comments but not books, calendars or slideshows. The original library will be left untouched for further attempts at fixing the problem or in case the rebuilt library is not satisfactory. -
Having trouble adding my Mac Pro Tower to my Apple ID not sure why it does not work
Having trouble adding my MacPro Tower to my Apple Id will not allow me to download the music and videos I purchase on my Iphone or IPad... Very frustrated with apple....
Tank 64 wrote:
My Daughter changed her Apple ID, not sure why. Then she changed it back to the original. She has lost $50 on her iTunes. How does she restore the funds?
How did she change her AppleID?
If she simply updated the AppleID (not created a new one with a new email address), log out then log back into iTunes store. -
I bought a new Iphone 4s at walmart with my at&t upgrade and today, it caught fire, melted a hole in the battery and melted the screw connectors on the bottom of the phone and the back came off.. Im not sure what to do on this deal.. Im now trying to get it to work and dont want to spend 500.00 on a new phone when this one messed up for no reason.. Luckly it just burnt one of my fingers.. where is was it could had burnt my house down very easy.
<E-mail Edited by Host>If safe, carefully slide iPhone into a plastic bag, double bag it for sure. Use items like pencils or kitchen utensils so you do not touch it. Make Genius reservation, and take it to Apple for replacement under Warranty.
-
This is very annoying because I really enjoy using launchpad. I have a lot of applications in there and I hate having to reorganize everything. I messed with a third party application before to backup/restore my launchpad layout, but it had some issues with Mountain Lion so I ditched it. Any thoughts?
Threads are just processes that link together like the threads in these discussions, well, maybe that is a bad example given how disjointed these get
It looks like you are not pushing the cpu or hard drive enough to cause your behavior. Not sure what the temperature limit on that cpu is, on the newer models it is around 100-110 °C which is notciabley hot, and the system shutsdown for self protection at the thermal limit.
You could be hitting a thermal limit causing that behavior...so do you see good behavior at lower load levela on the system? Does this only happen with when you are under the high graphic loads?
Trying to zero in on when this occurs to see if we an isolate the problem. -
Just trying to access my wifi using my iphone
Usually it's because you are not making internet connection via wifi.
Look at iOS Troubleshooting Wi-Fi networks and connections http://support.apple.com/kb/TS1398
iPad: Issues connecting to Wi-Fi networks http://support.apple.com/kb/ts3304
Additional things to try.
Try this first. Turn Off your iPad. Then turn Off (disconnect power cord) the wireless router & then back On. Now boot your iPad. Hopefully it will see the WiFi.
Change the channel on your wireless router. Instructions at http://macintoshhowto.com/advanced/how-to-get-a-good-range-on-your-wireless-netw ork.html
How to Quickly Fix iPad 3 Wi-Fi Reception Problems
http://osxdaily.com/2012/03/21/fix-new-ipad-3-wi-fi-reception-problems/
If none of the above suggestions work, look at this link.
iPad Wi-Fi Problems: Comprehensive List of Fixes
http://appletoolbox.com/2010/04/ipad-wi-fi-problems-comprehensive-list-of-fixes/
Fix iPad Wifi Connection and Signal Issues http://www.youtube.com/watch?v=uwWtIG5jUxE
Cheers, Tom -
My Ipod won't sync when I plug it into the computer. What is wrong?
Hi,
See this Link for Device not Recognised:
http://www.apple.com/support/ipod/
This could be Helpful too:
AMDS for Windows
http://support.apple.com/kb/TS1567
General Support Link:
http://www.apple.com/support/ipod/
Cheers, -
I just recently tried to plug my iphone 4s into intunes. It comes up with the menu of what action do you want to take. My only options only involve photos and videos nothing to do with syncing or music. When I open itunes it does not even show my device in itunes. What do I do??
uninstall itunes
you may have to manually delete anything related to itunes in regedit
reboot and reinstall itunes -
I keep getting told that I have no more application memory and have to force quit applications. Why does this happen and how do I fix it? This issue has only started since I started using Mavericks 10.9.2.
Have you checked how much space you have left on your HDD? You may find some useful information here:
pondini.org/OSX/DiskSpace.htmlhttp://
Ciao. -
I've got a new iphone 5 and i dont know why im unable to complete purchase of Apps from itunes store,i keep getting error message saying contact itunes store support to complete this transaction...i would really appreciate if anyone would assist in any way
If you haven't already done so then you can contact iTunes support via this page and ask them why the message is appearing (these are user-to-user forums, we won't know) : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page
Maybe you are looking for
-
I am running version 3.6.15
-
We recently bought 3 new Intel Core Duo running 10.4.8 but we have to downgrade to 10.4.7 since our POS manufacturer informs us that there are some issues with 10.4.8. The downgrade seems okay but when we try to change the date in the Point of Sale s
-
Hi Using Oracle 10.2 , HP-UX 11.23, ECC 6.0 SR3. I am running sapinst with homogeneous system copy option. Database already restored and opened properly. Getting error during backup/restore step -creating the password file. Looking at the sapinst log
-
How often is TCP_DATAREADY generated?
What I'm doing: I'm working on adding a Wi-Fi module to a product that uses a small embedded micro-controller. The micro operates as a TCP server communicating via Wi-Fi. I've developed a LabWindows/CVI application to display the data that the micro
-
What happened with ViewPortAccess?
Hi, I'm porting a plugin from CS6 to CC (10.2), and I'm struggling with the class ViewPortAccess which is available in the CS6 SDK but isn't in the CC one. So far, I did not find anything in porting guide etc., could someone point me in the right dir