Data Repetition- in SQL Query
Hi,
I am Working on a report that is based on MRP Vs Purchase Order.In MRP table, ORCM I take ItemCode,Quantity.These recommendatios are not created into purchase order.In these, the datas are repeating in ORCM.
~
Roseline Christina.B
You just use "group by" clause in your query.
-Manmath
Similar Messages
-
Can we use Data Pump to export data, using a SQL query, doing a join
Folks,
I have a quick question.
Using Oracle 10g R2 on Solaris 10.
Can Data Pump be used to export data, using a SQL query which is doing a join between 3 tables ?
Thanks,
AshishHello,
No , this is from expdp help=Y
QUERY Predicate clause used to export a subset of a table.
Regards -
Hello,
I have a simple SQL query in a report.
select
null as "Complete",
a.col1,
a.col2,
a.col3,
a.col4,
b.col2
from TableA a, TableB b
where a.id = b.idThere is a known issue in apex 4.0 that is causing the "When No Data Found" message to work incorrectly so that this is returned:
report error:
ORA-01403: no data found
Is there a way to return a message in a SQL statement? If not, any suggestions on how I can convert this in the existing report to PL/SQL would be appreciated.
Thanks!
MattI would like to do something similar to this (below) but the only option that is given other than "SQL Query" is “PL/SQL function body returning a SQL query”
I'm not sure how to do this as a funciton.
declare
vComplete Varchar2;
vCol1 Varchar2;
vCol2 Varchar2;
vCol3 Varchar2;
vCol4 Varchar2;
vColB2 Varchar2;
Begin
select
null as "Complete",
a.col1,
a.col2,
a.col3,
a.col4,
b.col2
into vComplete,vCol1,vCol2,vCol3,vCol4,vColB2
from TableA a, TableB b
where a.id = b.id
Dbms_output.put_line(vComplete,vCol1,vCol2,vCol3,vCol4,vColB2);
Exception
When no_data_found
Dbms_output.put_line(vComplete,vCol1,vCol2,vCol3,vCol4,vColB2);
When others
Dbms_output.put_line(‘exception handling message’);
End; -
Why some columns are not read into Power Pivot when reading data from a SQL query
I have this SQL query that I want to use to read data to PowerPivot from:
SELECT Score.FieldCount as fieldcount, Score.Record.GetAt(0) as predicted_gender, Score.Record.GetAt(1) as probability_of_gender, Score.Record.GetAt(2)
as probability_of_m,
Score.Record.GetAt(3) as probability_of_f, Score.Record.GetAt(4) as customerkey
FROM
SELECT * FROM dbo.myCLR1(
dbo.MyCLR2('c:\fILES\MLSM.xml'),
'SELECT * FROM [dbo].[Customer]') Input
) Score
After I click 'Finish' in "Table Import Wizard", I can only get 1 column (FieldCount) in Power Pivot window. Why don't I get the other 4 columns? If I save the result to a table I do get all columns but my goal is to dynamically present the result
so that's not an option. Can anyone shed some light?
Thanks,
Chu
-- Predict everything. http://www.predixionsoftware.comIf I only pass in query as
SELECT * FROM dbo.myCLR1(
dbo.MyCLR2('c:\fILES\MLSM.xml'),
'SELECT * FROM [dbo].[Customer]') Input
I do get 2 columns (FieldCount and Record as shown below)
-- Predict everything. http://www.predixionsoftware.com -
How do I pull SharePoint 2013 list data using a SQL Query
I have been asked to write a sql query to pull data from a SharePoint 2013 List.it needs to return all the columns
Basically a Select all from the specific SharePoint list Database
I do have the list GUID ID. But not sure which SQL Table or Database to look in for list data.. the site and the list is in our main SharePoint site collection.
the query only needs to be saved in SQL serverI know it isn't support but sometimes you have to share data with other programs....
I'm stuck.. I was able to get this far...
SELECT * FROM dbo.Lists
where tp_Title ='List Name'
how do I pull the columns of the list?
I think I still need the specific list not just the master list dbo....
those two links do not work for SQL server and SharePoint 2013 -
Morning all,
I've just been assigned a report-related project but I have not created much of anything in C# or .Net before!
I was wondering if someone could help me get started. Here are the specifications:
Basically, I am to create an automated report application. I have the query and I will include it further down
in this post. The page is to have a couple blanks to specify the Start Date and End Date and replace those dates in the query, and generate the report. What I need some help on is how to make the SQL query work in the application which I will connect to the
intended database to generate the report (basic I know, but I'm new at this) on Visual Studio 2010. I also need some help on programming the Start Date blank and End Date blank so that what the user types in for those blanks will replace the date fields in
the SQL query, then generate the report with the new dates.
I appreciate the help!
The SQL query and what the dates are replacing:
select
PTH.INST_ID ,
PTH.EMPLOYEE_ID,
DBH.HR_DEDUCTION_AND_BENEFITS_CODE,
replace(DB.DESCRIPTION,',',''),
DB.WITHHOLDING_LIABILITY_ACCOUNT_MASK,
DBH.HR_DEDUCTION_AND_BENEFITS_ID,
DBH.CHECK_DATE,
DBH.CHECK_NO,
DBH.FIN_INST_ACCT_ID,
replace(replace (DBH.COMMENT,CHAR(10),' '),CHAR(13),' '),
DBH.HR_DEDUCTION_AND_BENEFIT_CYCLE_CODE,
DBH.LENGTH,
DBH.EMPLOYEE_COMPUTED_AMOUNT,
DBH.EMPLOYEE_BANK_ROUTING_NUMBER,
DBH.EMPLOYEE_ACCOUNT_TYPE,
DBH.EMPLOYEE_ACCOUNT_NUMBER,
DBH.EMPLOYER_COMPUTED_AMOUNT,
DBH.EMPLOYEE_GROSS_AMOUNT,
DBH.EMPLOYER_GROSS_AMOUNT,
DBH.PAYROLL_EXCLUDE,
PTH.VOID_DATE,
PTH.BATCH_QUEUE_ID,
B.BATCH_CODE,
BQ.FY,
BQ.END_DATE,
BQ.COMMENTS,
BQ.BATCH_CRITERIA_USED,
BP.COLUMN_VALUE,
PTH.REPLACEMENT,
P.LAST_NAME,
P.FIRST_NAME,
P.MIDDLE_NAME
from PY_EMPLOYEE_TAX_HISTORY PTH
INNER JOIN PERSON_EMPLOYEE PE ON
PE.INST_ID=PTH.INST_ID AND
PE.EMPLOYEE_ID=PTH.EMPLOYEE_ID
INNER JOIN PERSON P ON
PE.INST_ID=P.INST_ID AND
PE.PERSON_ID=P.PERSON_ID
LEFT JOIN HR_EMPLOYEE_DEDUCTIONS_AND_BENEFITS_HISTORY DBH ON
PTH.INST_ID=DBH.INST_ID AND
PTH.CHECK_DATE=DBH.CHECK_DATE AND
PTH.CHECK_NO=DBH.CHECK_NO AND
PTH.EMPLOYEE_ID=DBH.EMPLOYEE_ID
LEFT JOIN HR_DEDUCTION_AND_BENEFITS DB ON
DB.INST_ID=DBH.INST_ID AND
DB.HR_DEDUCTION_AND_BENEFITS_CODE=DBH.HR_DEDUCTION_AND_BENEFITS_CODE
LEFT JOIN BATCH_QUEUE BQ ON
PTH.BATCH_QUEUE_ID=BQ.BATCH_QUEUE_ID
LEFT JOIN BATCH B ON
B.BATCH_CODE=BQ.BATCH_CODE
LEFT JOIN BATCH_PARAMETER BP ON
BQ.BATCH_QUEUE_ID=BP.BATCH_QUEUE_ID
AND BP.COLUMN_NAME = 'SUPPRESS_DIRECT_DEPOSIT'
------Please change the WHERE condition for date range of the month you need to run this for.
WHERE PTH.CHECK_DATE >='07/01/2013'
AND PTH.CHECK_DATE <='07/31/2013'
and BQ.BATCH_CODE='BAT_PY_PAYCALC'
and bq.fy=2014
ORDER BY PTH.INST_ID ,
PTH.EMPLOYEE_ID,
DBH.HR_DEDUCTION_AND_BENEFITS_CODE,
DBH.CHECK_DATETry this code. The Server name will be the same name when you use SQL Server Management Studio (SSMS). It is in the login window for SSMS. I assume you are using SQLSTANDARD (not SQLEXPRESS) which is in the connection string in the code
below. I also assume you have remote connection allowed in the database.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
namespace ConsoleApplication1
class Program
const string DATABASE = "Enter Database Name Here";
const string SERVER = "Enter Server Name Here";
static void Main(string[] args)
DateTime startDate = DateTime.Parse("07/01/2013");
string startDateStr = startDate.ToString("MM/dd/yyyy");
DateTime endDate = new DateTime(startDate.Year, startDate.Month + 1, 1).AddDays(-1);
string endDateStr = endDate.ToString("MM/dd/yyyy");
string connStr = string.Format("Server={0}\\SQLSTANDARD;Database={1};Trusted_Connection= True;", SERVER,DATABASE);
string SQL = string.Format(
"select\n" +
" PTH.INST_ID\n" +
",PTH.EMPLOYEE_ID\n" +
",DBH.HR_DEDUCTION_AND_BENEFITS_CODE,\n" +
",replace(DB.DESCRIPTION,',','')\n" +
",DB.WITHHOLDING_LIABILITY_ACCOUNT_MASK\n" +
",DBH.HR_DEDUCTION_AND_BENEFITS_ID\n" +
",DBH.CHECK_DATE\n" +
",DBH.CHECK_NO\n" +
",DBH.FIN_INST_ACCT_ID\n" +
",replace(replace (DBH.COMMENT,CHAR(10),' '),CHAR(13),' ')\n" +
",DBH.HR_DEDUCTION_AND_BENEFIT_CYCLE_CODE\n" +
",DBH.LENGTH\n" +
",DBH.EMPLOYEE_COMPUTED_AMOUNT\n" +
",DBH.EMPLOYEE_BANK_ROUTING_NUMBER\n" +
",DBH.EMPLOYEE_ACCOUNT_TYPE\n" +
",DBH.EMPLOYEE_ACCOUNT_NUMBER\n" +
",DBH.EMPLOYER_COMPUTED_AMOUNT\n" +
",DBH.EMPLOYEE_GROSS_AMOUNT\n" +
",DBH.EMPLOYER_GROSS_AMOUNT\n" +
",DBH.PAYROLL_EXCLUDE\n" +
",PTH.VOID_DATE\n" +
",PTH.BATCH_QUEUE_ID\n" +
",B.BATCH_CODE\n" +
",BQ.FY\n" +
",BQ.END_DATE\n" +
",BQ.COMMENTS\n" +
",BQ.BATCH_CRITERIA_USED\n" +
",BP.COLUMN_VALUE\n" +
",PTH.REPLACEMENT\n" +
",P.LAST_NAME\n" +
",P.FIRST_NAME\n" +
",P.MIDDLE_NAME\n" +
" from PY_EMPLOYEE_TAX_HISTORY PTH\n" +
" INNER JOIN PERSON_EMPLOYEE PE ON\n" +
" PE.INST_ID=PTH.INST_ID AND\n" +
" PE.EMPLOYEE_ID=PTH.EMPLOYEE_ID\n" +
" INNER JOIN PERSON P ON\n" +
" PE.INST_ID=P.INST_ID AND\n" +
" PE.PERSON_ID=P.PERSON_ID\n" +
" LEFT JOIN HR_EMPLOYEE_DEDUCTIONS_AND_BENEFITS_HISTORY DBH ON\n" +
" PTH.INST_ID=DBH.INST_ID AND\n" +
" PTH.CHECK_DATE=DBH.CHECK_DATE AND\n" +
" PTH.CHECK_NO=DBH.CHECK_NO AND\n" +
" PTH.EMPLOYEE_ID=DBH.EMPLOYEE_ID\n" +
" LEFT JOIN HR_DEDUCTION_AND_BENEFITS DB ON\n" +
" DB.INST_ID=DBH.INST_ID AND\n" +
" DB.HR_DEDUCTION_AND_BENEFITS_CODE=DBH.HR_DEDUCTION_AND_BENEFITS_CODE\n" +
" LEFT JOIN BATCH_QUEUE BQ ON\n" +
" PTH.BATCH_QUEUE_ID=BQ.BATCH_QUEUE_ID\n" +
" LEFT JOIN BATCH B ON\n" +
" B.BATCH_CODE=BQ.BATCH_CODE\n" +
" LEFT JOIN BATCH_PARAMETER BP ON\n" +
" BQ.BATCH_QUEUE_ID=BP.BATCH_QUEUE_ID\n" +
" AND BP.COLUMN_NAME = 'SUPPRESS_DIRECT_DEPOSIT'\n" +
" WHERE PTH.CHECK_DATE >='{0}'\n" +
" AND PTH.CHECK_DATE <='{1}'\n" +
" and BQ.BATCH_CODE='BAT_PY_PAYCALC'\n" +
" and bq.fy=2014\n" +
" ORDER BY PTH.INST_ID\n" +
",PTH.EMPLOYEE_ID\n" +
",DBH.HR_DEDUCTION_AND_BENEFITS_CODE\n" +
",DBH.CHECK_DATE", startDateStr, endDateStr);
SqlDataAdapter adapter = new SqlDataAdapter(SQL, connStr);
DataTable dt = new DataTable();
adapter.Fill(dt);
jdweng
Could you elaborate more on what this code does in general?
Does it generate a table with the data between specified dates? If so, where is the table shown?
Where does one enter in the specified start and end dates on the Web Application? Do I have to create start and end date blanks and link them to the code for it to work?
Sorry for the inconvenience - I'm just really new at this. Thanks! -
Hi,
I am using from_date and to_date parameters. Data type and Param type for both are 'Date' and my Format string is 'dd/MM/yyyy'
I need to pass these two values to my data model which is SQL query. Whenever I use below WHERE clause I am getting
"ORA-01858: a non-numeric character was found where a numeric was expected", Please let me know how to fix this error.
trunc(a.scan_timestamp) between to_char(to_date(:p_from_date,'DD/MM/YYYY'),'DD-MON-YYYY') and
to_char(to_date(:p_to_date,'DD/MM/YYYY'),'DD-MON-YYYY')Hello,
if you choose Date for Data type and Parameter Type for the parameters then the format of your date has nothing to do with your selection.
Please try
trunc(a.scan_timestamp) between :p_from_date and :p_to_date
Wolfgang -
Checking correct data format using sql query
1) I got column date of joining which accepts date in below format
DD-MON-YYYY
DD-MON-YY
MON-DD-YYYY
MON-DD-YY
Month DD,YYYY
Question:- how do i check whether all dates in Date of joining column are in above format or not using sql query?
2) I got one more date column which accepts date in below format
MMDDYYYY
YYYYMMDD
MM/DD/YYYY
MM/DD/YY
YYYY/DD/MM
Question:- how do i check whether all dates in date column are in above format or not using sql query?
sorry if it is a very simple question since I am new to sql and trying to learn ......Thanks for the answers from the group............In short, NO, it's not possible. If you store dates correctly in the database as DATE datatype then you don't have this problem. If you store them as VARCHAR2 you have a problem.
So, you get a date of 20092012
Is that 20th September 2012? or is it 20th December 2009?
What about...
11-Jan-12
Is that 11th January 2012 or 12th January 2011?
Dates should never be stored on the database as strings. That is why Oracle gives you a DATE datatype so you can store them properly.
Also, when dates are passed from an application to the database, the application should be passing them as DATE datatype, and the application interface should be designed to accept dates from the user in a format specific to their country/locality and it would then know what that format is and automatically convert it to a DATE datatype before it gets anywhere near the database or any SQL. -
To Get List of Tables from Database which has the data 'AAAA' - T-SQL Query
Hi,
I have a database "Adventureworks", I need to get list of tables, which has the data 'AAAA' in their rows.
Is there any optimised or simple way to do this task?
Any T-SQL Query Available
--- Thanks in advance..You can refer the same below URL provided by Praveen:
https://gallery.technet.microsoft.com/scriptcenter/c0c57332-8624-48c0-b4c3-5b31fe641c58
It has the SQL SP - "SP_SearchTables". You can pass parameters the way you want and get the expected output.
-- Search for 'bike' instead of 'AAAA'
Use AdventureWorks2012
EXEC SP_SearchTables @Tablenames = '%', @SearchStr = '%bike%'
-Vaibhav Chaudhari -
How to Get Default Value of a Data Type in SQL Query.
Hi all,
I am creating a procedure which will take input the table name and Column Name.
In the Output i would like to have the data type and default value of that data type which will be used by a another procedure to blank the selected column in the database.
I tried with SET NULL on the column but as the database is of navision the table have property set to NOT NULL.
Here is what i have done till now.
Create Procedure Get_Column_type
@parm_table_name nvarchar(200),
@parm_column_name nvarchar(20),
@parm_result nvarchar(20)OUTPUT
AS
BEGIN
select @parm_result =
DATA_TYPE from INFORMATION_SCHEMA.COLUMNS IC
where TABLE_NAME = '[' + @parm_table_name +']' and COLUMN_NAME = '[' + @parm_column_name + ']'
END
GO
Now instead on write a case statement for so many data types in SQL, i was thinking is it possible someway that above procedure also returns the default value which i can set in another procedure.
Let me know if its possible or not? Thanks in advance.Do you looking for something like this?
create table t10 ( c int default 1)
SELECT so.name AS table_name,
sc.name AS column_name,
sm.text AS default_value
FROM sys.sysobjects so
JOIN sys.syscolumns sc ON sc.id = so.id
LEFT JOIN sys.syscomments SM ON sm.id = sc.cdefault
WHERE so.xtype = 'U'
AND SO.name = 't10'
ORDER BY so.[name], sc.colid
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Weird Date Problem in SQL Query
Dear Members,
Iam using the following query:
SQL>select api.attribute2 PO_NO,
substr(api.attribute4, 10, 5) REL_NO,
api.invoice_num,
SUM(T.ACCOUNTED_DR) DR,
SUM(T.ACCOUNTED_CR) CR
from gl.gl_je_lines t, GL_CODE_COMBINATIONS GCC, ap_invoices_all api
WHERE T.SET_OF_BOOKS_ID IN (7)
AND TO_DATE(TO_DATE(t.PERIOD_NAME, 'MON-YY'), 'DD-MON-YY') =
TO_DATE(TO_DATE('&P_PERIOD_FROM', 'MON-YY'), 'DD-MON-YY')
AND TO_DATE(TO_DATE(t.PERIOD_NAME, 'MON-YY'), 'DD-MON-YY') <=
TO_DATE(TO_DATE('&P_PERIOD_TO', 'MON-YY'), 'DD-MON-YY')
AND T.CODE_COMBINATION_ID = GCC.CODE_COMBINATION_ID
AND GCC.SEGMENT5 = '&P_ACCOUNT'
and t.reference_2 = api.invoice_id
GROUP BY api.attribute2, substr(api.attribute4, 10, 5), api.invoice_num
order by api.attribute2, substr(api.attribute4, 10, 5), api.invoice_num
In the above query iam giving two types of parameters:
Type1:
Account:=17400650
P_PERIOD_FROM:='JAN-07'
P_PERIOD_to:='DEC-07'
For the above type of parameters the query is running fine and giving desired results.
Type2:
Account:=36210040
P_PERIOD_FROM:='JAN-07'
P_PERIOD_to:='DEC-07'
For the above type of parameters it is giving me the error: ora-01843 not a valid month_
Can any one please tell me what is the reason for this weird problem.
Your inputs will be of great help to me.
Thanks in advance.
Best Regards,
Arun ReddyPlease review Note:338832.1
How to debug ORA-01843: not a valid month, ORA-01821: date format not recognized, ORA-1801 -
Selecting values between 2 dates for an SQL query report region
I have a region where im selecting between 2 dates
select hp.NAME, hp.VALUE, hp.UPDATEDATE, hp.DESCRIPTION, hp.UPDATE_COMMENT, hp.HASH, hp.IDCATEGORY
from HIST_REPORT hr, HIST_PARAM hp
where hp.dbid = hr.dbid and hr.id = :P7_ID and hp.UPDATEDATE between :P7_BDATE and :P7_EDATE
The problem is that if I have a row thats dated today (april 1) and if I set the beginning date (BDATE) to april 1 as well as the ending date (EDATE), no rows show and I would like the april 1 row to show. How can I modify my query to fix this?and hp.UPDATEDATE between :P7_BDATE
and decode(:P7_EDATE,:P7_BDATE,:P7_EDATE+1,:P7_EDATE)This assumes, though, that the time component of your items is implicitly 00:00.
Joel -
Utility to export selected data from an SQL Query?
I would like to know if there is any utility available in Oracle that I could use to export data selected on the basis of a query? Our requirement is to export the selected data to .dat file.
This should be besides imp or exp built-in utilities available in Oracle.Hello,
you can spool the results of your query to file.
eks
spool c:\....
select * from emp;
spool off;
If you have a tool called Toad, you kan click on the results and then you can save the data in different format.
Regards
Kjersti -
Problems with java constructor: "inconsistent data types" in SQL query
Hi,
I tried to define a type "point3d" with some member functions, implemented in java, in my database. Therefor I implemented a class Point3dj.java as you can see it below and loaded it with "loadjava -user ... -resolve -verbose Point3dj.java" into the database.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
package spatial.objects;
import java.sql.*;
public class Point3dj implements java.sql.SQLData {
public double x;
public double y;
public double z;
public void readSQL(SQLInput in, String type)
throws SQLException {
x = in.readDouble();
y = in.readDouble();
z = in.readDouble();
public void writeSQL(SQLOutput out)
throws SQLException {
out.writeDouble(x);
out.writeDouble(y);
out.writeDouble(z);
public String getSQLTypeName() throws SQLException {
return "Point3dj";
public Point3dj(double x, double y, double z)
this.x = x;
this.y = y;
this.z = z;
public static Point3dj create(double x, double y, double z)
return new Point3dj(x,y,z);
public double getNumber()
return Math.sqrt(this.x*this.x + this.y*this.y + this.z*this.z);
public static double getStaticNumber(double px, double py, double pz)
return Math.sqrt(px*px+py*py+pz*pz);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Additionally, I created the corresponding type in SQL by
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CREATE OR REPLACE TYPE point3dj AS OBJECT EXTERNAL NAME
'spatial.objects.Point3dj' LANGUAGE JAVA USING SQLDATA (
x FLOAT EXTERNAL NAME 'x',
y FLOAT EXTERNAL NAME 'y',
z FLOAT EXTERNAL NAME 'z',
MEMBER FUNCTION getNumber RETURN FLOAT
EXTERNAL NAME 'getNumber() return double',
STATIC FUNCTION getStaticNumber(xp FLOAT, yp FLOAT, zp FLOAT) RETURN FLOAT
EXTERNAL NAME 'getStaticNumber(double, double, double) return double')
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
After that I tried some SQL commands:
create table pointsj of point3dj;
insert into pointsj values (point3dj(2,1,1));
SELECT x, a.getnumber() FROM pointsj a;Now, the problem:
Everything works fine, if I delete the constructor
public Point3dj(double x, double y, double z)
this.x = x;
this.y = y;
this.z = z;
in the java class, or if I replace it with a constructor that has no input arguments.
But with this few code lines in the java file, I get an error when executing the SQL command
SELECT x, a.getnumber() FROM pointsj a;The Error is:
"ORA-00932: inconsistent data types: an IN argument at position 1 that is an instance of an Oracle type convertible to an instance of a user defined Java class expected, an Oracle type that could not be converted to a java class received"
I think, there are some problems with the input argument of the constructor, but why? I don't need the constructor in SQL, but it is used by a routine of another java class, so I can't just delete it.
Can anybody help me? I would be very glad about that since I already tried a lot and also search in forums and so on, but wasn't successful up to new.
Thanks!Dear Avi,
This makes sense when it is a short code sample (and i think i've done that across various posts), but sometime this is too long to copy/paste, in these cases, i refer to the freely available code samples, as i did above on this forum; here is the quote.
Look at examples of VARRAY and Nested TABLES of scalar types in the code samples of my book (chapter 8) http://books.elsevier.com/us//digitalpress/us/subindex.asp?maintarget=companions/defaultindividual.asp&isbn=9781555583293&country=United+States&srccode=&ref=&subcode=&head=&pdf=&basiccode=&txtSearch=&SearchField=&operator=&order=&community=digitalpress
As you can see, i was not even asking people to buy the book, just telling them where to grab the code samples.
I appreciate your input on this and as always, your contribution to the forum, Kuassi -
Help with Date function in sql query....
My question I guess is really 2...I'm trying to use the date function as a comparison in my WHERE clause in my sql command.
1. My date format is dd-MMM-yy eg. (01-Apr-06) ... my problem is the Apr is lower case where my field in the database is 01-APR-06 so when I compare 01-Apr-06 to 01-APR-06 is doesnt find any rows. Is there away that I can make the Apr all upper case so that it is APR.
2. My second problem is getting this "date" field to work in my sql stmt I keep getting errors and it works fine if I take my attempts at trying to compare the date.
--------------Date Code----------------------------------------------------------
<%!
String getFormattedDate(java.util.Date d)
SimpleDateFormat simpleDate = new SimpleDateFormat("01-MMM-yy");
return simpleDate.format(d);
%>
<%
java.util.Date d = new java.util.Date();
String dateString = getFormattedDate (d);
%>
---------------------------Sql statment------------------------------------------
ResultSet rset = stmt.executeQuery ("SELECT name " + " FROM table where rdate = '01-APR-06' order by name ");
Currently Im just hard coding the date but I need to make it so it uses the date code...so....
rdate should equal the date from the formatted date in upper case
something like
rdate = <%= dateString %>
Thanks in advance for any ideas anyone may have...There are sql functions upper & lower.
SELECT name FROM table where upper(rdate) = '01-APR-06' order by name Or you could convert the date to a string, and use the toUpperCase & toLowerCase java.lang.String methods. It doesn't make much of a difference--do you want the java compiler to do the string conversion or the database?
Maybe you are looking for
-
SSRS Parameter value from another parameter
Hello Everybody, I have a parameter that I need to get it value from another parameter. The first parameter @rdt is a date - 11/01/2012 The second parameter @mm is the year and month = 2012 I tried putting in a select inside the query but it did not
-
Hello, I want to use version controlling software with Labwindows.
Hello All. I want to use version controlling tool with Labwindows/CVI. Actually version controlling tools work for text files and by using the tool i can do version controlling of my .c and .h files in Labwindows/CVI project. But is there a way to do
-
All of a sudden my email is being blocked. I have [email protected] forwarded to [email protected] Apple is not supporting me. I'm getting the following: SMTP error from remote mail server after RCPT TO: <[email protected]>: host mx3.me.com.akadns
-
Lightoom 4.4, Camera raw 7.4 and D800E NEF files
I am trying to get a NEF files made on a Nikon D800E to Import to Lightroom 4.4 with Camera raw 7.4. I get an error that states the following files were not imported because they could not be read. I can import them to Photoshop CS6 and use them in p
-
Repeating groups in logical data model
Hello, I am trying to create a logical data model where the following rules are applied: Each Renovation Job may include one or more Rooms. Each Room can be included in one or more Renovation Jobs. Each Room Renovation may have one or more Renovation