How would I rewrite SELECT NEXT_DAY(SYSDATE, 'Sunday') NEXT_SUNDAY FROM DUAL in Java?
Hi everyone,
Being new to Java, I am finding that things I took for granted in SQL and PL/SQL are far from "second nature" here!
Would someone tell me how would I rewrite the following in Java (for ADF)? My Google and OTN Community searches are coming up empty-handed. Any function in which I pass a date and get a date back for the next Sunday is fine, i.e., I don't need the SQL.
select
next_day(sysdate, 'Sunday') next_sunday
from dual;
Thanks in advance!
James
public void calculateNextDay()
Calendar c=Calendar.getInstance();
c.set(Calendar.DAY_OF_WEEK,Calendar.SUNDAY);
c.set(Calendar.HOUR_OF_DAY,0);
c.set(Calendar.MINUTE,0);
c.set(Calendar.SECOND,0);
DateFormat df=new SimpleDateFormat("EEE yyyy/MM/dd HH:mm:ss");
//PRINT PAST SUNDAY
System.out.println("past sunday - " + df.format(c.getTime()));
c.add(Calendar.DATE,7);
//PRINT NEXT SUNDAY
System.out.println("next sunday - " + df.format(c.getTime()));
c.add(Calendar.DATE,7);
Similar Messages
-
Hi Team
WE have a EBS 11.5.10.2 with DB 11.1.0,7 on HPUX 11.23.
And we have a error;
APP:
FRM-40735: ON_ERROR trigger raised unhandled exception ORA-01001
SQL> select fnd_web_sec.URLEncrypt('hello', 'world') from dual;
select fnd_web_sec.URLEncrypt('hello', 'world') from dual
ERROR at line 1:
ORA-03113: end-of-file on communication channel
Process ID: 10119
Session ID: 978 Serial number: 7
Regards,
GuidoModeration:
Stay with your original thread on this topic:
https://forums.oracle.com/thread/2595095
It is current and people have already tried to help you there.
This new duplicate post is locked. -
How would i can select multiple photos in album in a shot?
I would like to select mutiple photos in my album in a shot, so that i can share my photostream.Is there any way to do that?If not, when can we expect this feature?I feel this is a must have feature
Read here:
http://support.apple.com/kb/ts4379 -
How to generate multiple records on a single sql from dual table
I wanted to generate ten sequence nos in a single sql statement from dual table.
Is there any way to use that.
I think somebody can help me on this by using level clauseI'm not 100% sure if I understand your requirement: Do you really want to use an Oracle Sequence, as Alex already demonstrated?
Or just a 'one-time-bunch-of-sequential-numbers'.
In the latter case you can just select level:
SQL> select level
2 from dual
3 connect by level <= 10;
LEVEL
1
2
3
4
5
6
7
8
9
10
10 rows selected. -
How would I rewrite this shell script in PowerShell?
This shell script lists the size of a directory and its subdirectories alphabetically then lists the name of the subdirectory with the highest disk usage along with its size. I'm completely new to PowerShell and would like to know how I would rewrite this
script in PowerShell. Thanks in advance.
#!/bin/sh
myvar="$PWD"
declare -i x=1
while true; do
$clear
echo "Enter directory path or 1 for current directory ";
read INPUT ;
case "$INPUT" in
1)INPUT="$myvar"
esac
echo "Disk space use (in KB) for each subdirectory ";
if [ -d "$INPUT" ]
then
echo "Directory exists ";
else
echo "Directory does not exist ";
fi
for d in "$INPUT"/*; do
if [ -d "$d" ]
then
du -h "$d"
x=x+1;
fi
done
echo "The subdirectory with the maximum disk space use:";
du -m "$INPUT"| sort -nr | head -n 2
donePowerShell uses looping constructs like any other scripting language. You'll need to at least make an attempt at translating this yourself because this forum isn't a free code-writing service. If you get stuck, you can ask for help.
-- Bill Stewart [Bill_Stewart] -
How would u rewrite this..
I want to rewrite this mehtod, i have tried this but i get errors
please help thanx
public Player findPlayer(String playerNo)
String pNo = playerNo;
Player player = (Player)playerMap.get(pNo);
return player;
}// end findPlayer()
this is the way i tried to rewrite it
public StudentDetails findStudent()
String getNo = s.getStudentID();
s =(StudentDetails)studentsMap.getNo;
return s;
I want to rewrite this mehtod, i have tried this but i
get errors
please help thanx
public Player findPlayer(String playerNo)
String pNo = playerNo;
Player player = (Player)playerMap.get(pNo);
return player;
}// end findPlayer()
this is the way i tried to rewrite it
public StudentDetails findStudent()
String getNo = s.getStudentID();
s =(StudentDetails)studentsMap.getNo;
return s;
maybe you should do something like
String getNo = s.getStudentID();
StudentDetails s = (StudentDetails)studentsMap.getNo;
return s; -
HOW TO GET THE SELECTED VALUE IN A ROW FROM ONE VIEW TO ANOTHER VIEW?
hi all,
I have a small issue.
i have created two views.In the table of the first view i'm selecting a row and pressing the button it will move to next view.
i am adding some fields manually in the table of the second view and pressing the save button.Here all the values should get updated corresponding to the field which i have selected in the first view.
I want to know how to get the particular field in the selected row from one view to another view.
Kindly help me.Hi,
Any data sharing accross views can be achiveved by defining CONTEXT data in COMPONENT CONTROLLER and mapping it to the CONTEXT of all the views. Follow the below steps.
1. Define a CONTEXT NODE in component controller
2. Define same CONTEXT NODE in all the views where this has to be accessed & changed.
3. Go to CONTEXT NODE of each view, right click on the node and choose DEFINE MAPPING.
This is how you map CONTEXT NODE and same can be accessed/changed from any VIEW or even from COMPONENT CONTROLLER. Any change happens at one VIEW will be automatically available in others.
Check the below link for more info regarding same.
[http://help.sap.com/saphelp_nw04s/helpdata/EN/48/444941db42f423e10000000a155106/content.htm]
Regards,
Manne. -
How would someone go about searching or finding songs from a certain year ?
I would like to find songs and albums from my high school years 1980 to 1983. What's the best way to find only songs from these years within the itunes store ? The search engine doesn't have any way to do this as far as i know. This feature would be nice to see added in the future.
The information is not even in the database to be searched. Each selection in the iTunes store contains only the year of release of the album. For the songs you seek, many will be found in albums like "Greatest Hits of the 80s" and show in the store with dates like 2001, 2004, etc.
As Mike and LMFZOR suggest, you would do better to browse the charts for the era, identify the songs that interest you, and then look for them in the store by title. -
How to read and select only a specific lines from a CSV file. Pls help
I have a java application to read a CSV file. I've already managed to read them all and output it to System.out.println(). Now the problem is I want to select a specific row of the records. How do I do it? Below is the codes i've typed.
FileReader fr = new FileReader(fileName);
BufferedReader inFile = new BufferedReader(fr);
StringBuffer buf = new StringBuffer();
String line = null;
while ((line = inFile.readLine()) != null) {
buf.append(line);
buf.append("\n");
String inString = buf.toString();
System.out.println(inString);
This is the record that i want to read. For example, I want to select n print out line "80,2.90,3.00,3.10,3.20,......."
[Factor1]
Time [s],0.00,0.10,0.20,0.30,0.40,0.50,0.60,0.70,0.80,0.90,1.00,1.10,1.20,1.30,1.40,1.50,1.60,1.70,1.80,1.90,2.00,2.10,2.20,2.30,2.40,2.50,2.60,2.70,2.80,2.90,3.00,3.10,3.20,3.30,3.40,3.50,3.60,3.70,3.80,3.90,4.00,4.10,4.20,4.30,4.40,4.50,4.60,4.70,4.80,4.90,5.00,5.10,5.20,5.30,5.40,5.50,5.60,5.70,5.80,5.90,6.00,6.10,6.20,6.30,6.40,6.50,6.60,6.70,6.80,6.90,7.00,7.10,7.20,7.30
Phi-0 [dB],-0.86,-0.80,-0.80,-0.99,-0.56,-0.53,-0.95If you know how many bytes each line is, you can use RandomAccessFile to skip directly to the byte position corresponding to your desired line. Otherwise, you'll have to read each line and just ignore the ones you don't want.
-
How would i go about editing a 3d video from cinema 4d in after effects?
i have made an intro for videos in cinema 4d, i would like to know how to edit this in 3d in after effects to add tweaks such as CC's and particles. i am using after effects cc by the way, advise is much appreciated
Ooohhh, you're jumping into the deep end of the pool wearing lead weights. Don't do that.
Instead, go here:
Getting started with After Effects (CS4, CS5, CS5.5, CS6, & CC)
You'll thank yourself later. -
How would I go about removing the required code from a form field?
I have this contact form that I downloaded and its fine. I just need to know how to remove the required field code from the contact no field.
Thanks in advance
Here is a link to the form and all of its assets
http://www.formget.com/jquery-contact-form/#comment-93253HTML code, change this:
<label>Contact No: <span>*</span></label>
To this:
<label>Contact No:</label>
jQuery code, change this:
if (name == '' || email == '' || contact == '') {
alert("Please Fill Required Fields");
} else {
to this:
if (name == '' || email == '') {
alert("Please Fill Required Fields");
} else {
Nancy O. -
How to read only files with a certain format from folder with java
I have this folder on the server and I only want to read files from this folder on the server... I only want to read files with the files format starting with error_ and ending with xml... an example of a file would be..
error_123.xml
I want something like this
if(fileName.startsWith("error_") && fileName.endsWith(".xml")){
but which java package will I have to use to read the file from the directory...Create an implementation of the java.io.FilenameFilter interface to match the pattern you need.
Create a java.io.File object for the folder.
Use the File.listFiles(FilenameFilter) method to get an array of File objects for the files in the folder that match the pattern.
For each file in the array, create a FileInputStream, wrap it in an InputStreamReader, and wrap that in a BufferedReader (assuming you want to read the XML files as character streams). -
this is my code
SET SERVEROUTPUT ON
DECLARE
CURSOR CUR_SELLOUT_MP IS
SELECT /*+ INDEX_JOIN(SO) */ TK.ID,
TMP_SELLOUT_MP.TGL,
TMP_SELLOUT_MP.TOTAL_PENJUALAN,
TMP_SELLOUT_MP.LGE,
TMP_SELLOUT_MP.NOKIA,
TMP_SELLOUT_MP.SE,
TMP_SELLOUT_MP.SS,
TMP_SELLOUT_MP.LAINNYA,
TMP_SELLOUT_MP.NAMA_TOKO,
TMP_SELLOUT_MP.KOTA,
TMP_SELLOUT_MP.NAMA_MP,
TO_CHAR(TGL, 'Day')
FROM REF_TOKO TK,
TEMP_SELLOUT_MP_HY TMP_SELLOUT_MP,
REF_SALES_OFFICER SO
WHERE UPPER(TK.NAMA) = UPPER(TMP_SELLOUT_MP.NAMA_TOKO)
AND UPPER(TMP_SELLOUT_MP.NAMA_MP) = UPPER(SO.NAMA)
AND SO.SOF_TYPE = 'MOBILEPROMOTOR';
CURSOR CUR_TGL IS
SELECT DISTINCT(TO_CHAR(TGL, 'Day')) AS TANGGAL FROM TEMP_SELLOUT_MP_HY;
V_A VARCHAR2(20);
BEGIN
FOR I IN CUR_TGL LOOP
V_A := I.TANGGAL;
IF V_A = 'Friday' THEN
DBMS_OUTPUT.PUT_LINE(V_A);
END IF;
END LOOP;
END;
why dbms_output.put_line not show??
this data from cursor CUR_TGL:
Thursday
Friday
Wednesday
Saturday
Edited by: xoops on Mar 11, 2010 9:21 AMWhat happens when you use:
SELECT DISTINCT(TO_CHAR(TGL, 'fmDay')) AS TANGGAL FROM TEMP_SELLOUT_MP_HY;Add 'fm' tyo the format, your match doesn't take the trailing space into account:
SQL> select '#'||to_char(sysdate, 'Day')||'#'
2 from dual;
'#'||TO_CHA
#Thursday #
SQL> select '#'||to_char(sysdate, 'fmDay')||'#'
2 from dual;
'#'||TO_CHA
#Thursday#Edited by: hoek on Mar 11, 2010 6:43 PM -
How would you read in each line of data and display them to message box?
How would you read in each line of data from the _.txt file_ and display the whole data using an information-type message box?
I know how to display each line of the .txt file data, but I do not know how to display the whole thing.
Here is how I did to display each line of data using the message box:
import javax.swing.JOptionPane; // Needed for the JOptionPane class
import java.io.*; // Needed for file classes
public class problem3
public static void main(String[] args) throws IOException
String filename; // Needed to read the file
String categories; // Needed to read the categories
// Get the filename.
filename = JOptionPane.showInputDialog("Enter the filname.");
// Open the file.
FileReader freader = new FileReader(filename);
BufferedReader inputFile = new BufferedReader(freader);
// Read the categories from the file.
categories = inputFile.readLine();
// If a category was read, display it and
// read the remainig categories.
while(categories != null)
// Display the last category read.
JOptionPane.showMessageDialog(categories);
// Read the next category.
categories = inputFile.readLine();
// Close the file.
inputFile.close();
}I think I need to change here:
// If a category was read, display it and
// read the remainig categories.
while(categories != null)
// Display the last category read.
JOptionPane.showMessageDialog(categories);
// Read the next category.
categories = inputFile.readLine();
}but I don't know how to.
Could you please help me?
Thank you.kyorochan wrote:
jverd wrote:
What is not understood about your question is which part of "read a bunch of lines and display them in a textbox" do you not understand.
First thing's first though: You do recognize that "read a bunch of lines and display them in a textbox" has a few distinct and completely independent parts, right?I'm sorry. I'm not good at English, so I do not understand what you said...
What I was trying to say is "How to display the whole lines of .txt file in single dialog box."We know that.
Do you understand that any problem can be broken down into smaller pieces?
Do you understand that your problem has the following pieces?
1. Read lines from the file.
2. Put the lines together into one String.
3. Put the String into the message box.
and maybe
4. Make sure the message box contents are split into lines exactly as the file was.
(You didn't make it clear if that last one is a requirement.)
Do you understand that 1-4 are completely independent problems and can be solved separately from each other?
Do you understand that you have stated that you already know how to do 1 and 3?
Therefore, you are NOT asking "How to display the whole lines of .txt file in single dialog box." Rather, you ARE asking either #2 or #4 or both.
If you say once more "display all the lines of the file in one dialog box," then it is clear that we are unable to communicate with you and we cannot help you. -
How to insert or select value d'silva
Hi,
How to insert or select value d'silva into/from table.
please let me know.
Thanks,
Sathis.Just escape the ' character:
SQL> insert into emp values(999, 'D''Silva', 'Jose');
1 row created.
SQL> select * from emp where last_name = 'D''Silva';
EMPLOYEE_ID LAST_NAME FIRST_NAME
999 D'Silva Jose
[pre]
Maybe you are looking for
-
I have been given an iphone 4 from one of my friends it seem that prior to ios 7 coming out he coudnt wait so he ilegally downloaded the software and now i can't activate it as it says my iphone is not regestered please help!
-
Email links won't open in Safari - keeps resetting to Mail
OS X Mavericks Safari 7.0 Mail 7.0 My email links in Safari were opening in Chrome. I opened Mail, went to Mail > Preferences > General and changed 'Default email reader' to Safari. Then my email links opened in Mail! Went back to Mail > Preferences
-
Possible to AVOID RECHARGING while using AC adapter to power up on Zen Tou
Hi there, I would really want to know if there's a possibilty that I can use the supplied AC adapter only for powering up the Zen Touch, but not recharging the battery everytime I plug in the adapter? For example I've some amount of charge in the bat
-
How do I crop landscape pictures in portrait with 2:3 ratio?
When I have a landscape picture and want it to crop in portrait format I don't know how to do it. I want to crop it in 3:2 ratio. When I enter that ratio it shows an 2:3 and not in 3:2 ratio. That way it's impossible to crop that image in a fixed 3:2
-
Bootcam Problem Windows 8.1 Please Help
I havea MacBook pro a1278model (2011 model) I have successfully installed windows 8.1 64bit using boot camp assistant However I am not able to install bootcamp on windows, as a result none of the drivers get installed I have downloaded Boot Camp Supp