How to numberformat when using sql:query alogn with c:forEach JSTL tags
Is there anyway to format the numeric values returned from the database when using <sql:query> alogn with <c:forEach> tags
Here is my jsp code
<sql:query..../>
<c:forEach var="row" items="${queryResults.rows}">
<tr>
<td><c:out value="${row.COL1}" /></td>
<td><c:out value="${row.COL2}" /></td>
</tr>
</c:forEach>
Col1 values are numeric without any formats Eg: 1000, 10000, 1000000 etc.
how can i format them to 1,000 , 10,1000 , 100,000 etc
It is polite to mention what your answer was. These posts are not just here for you to ask questions, but to be used as a resource for other people to find answers. Saying "I solved it" with no details helps noone.
I presume you discovered the JSTL <fmt:formatNumber> tag?
Similar Messages
-
How to backup database using sql query?
Hello,i'm student, i'm researching oracle database,i want to backup database that using sql query (like backup query in SQL SERVER) ,how to do that ??
Thank!No, database backups cannot be done from within the database.
Commands for backups are outside of the database.
See the "2 Day DBA Guide" http://download.oracle.com/docs/cd/E11882_01/server.112/e10897/toc.htm
and the "Backup and Recovery Users's (actually Adminsitrator's) Guide : http://download.oracle.com/docs/cd/E11882_01/backup.112/e10642/toc.htm
Hemant K Chitale -
How to get tax break up of TDS using SQL query ?
Hi all,
We are developing a TDS report using SQL query
Report will contain VendorCode,Date(ap inv date),Vendor name,
Bill value,TDS Amount,
Bill Value 100.000,
TDS (2%) - 2.000,
TDS Surcharge(10% on TDS) - 0.2,
TDS Cess(2%(TDS+TDS Surcharge)) - 0.044,
TDS HeCess(1%(TDS+TDS Surcharge)) - 0.022.
We have developed this report which displays upto
VendorCode,Date(ap inv date),Vendor name,
Bill value,TDS Amount.
How to show tax break up of TDS in SQL query ?
Thanks,
With regards,
Jeyakanthan.Hi gauraw,
Thank for your reply.
I modified the query , pasted the query
as below in query generator,
Select T0.DocNum,T0.DocDate,T0.CardCode as 'Ledger',T1.TaxbleAmnt As 'Bill value',T1.WTAmnt as 'TDSAmt',(TDSAmt * 0.1) as 'TDS_Surch',
(((TDSAmt0.1) + TDSAmt)0.02) as 'TDSCess',
(((TDSAmt0.1) + TDSAmt)0.01) as 'TDSHCess'
FROM OPCH T0 INNER JOIN PCH5 T1 ON T0.DocEntry = T1.AbsEntry
WHERE (T0.DocDate >= '[%0]' and T0.DocDate <= '[%1]')
on clicking execute its showing error message invalid column
name 'TDSAmt'.
With regards,
Jeyakanthan -
How to use sql query in java ?
i don't know how to use sql query in java code.
who can give me some advice?
thankshttp://java.sun.com/developer/onlineTraining/Database/JDBC20Intro/
-
hi i am face with problem that is i want to show the how much approximate space required for backup or .bak file to get backup using sql query because i want to show the required memory for backup file on my java application
Hi FIROZ
TENNALI
Is this still an issue, or can we close the thread?
* closing a thread by marking the answer/s (there is a link beneath each response) and you can vote for useful responses as well (there is a link to vote on the left of each response)
Ronen Ariely
[Personal Site] [Blog] [Facebook] -
How to Use SQL Query having IN Clause With DB Adapter
Hi,
I am using 11.1.1.5 want to find out how to Use SQL Query having IN Clause With DB Adapter. I want to pass the IN values dynamically. Any ideas.
Thanksinvoke a stored procedure, it's safer than trying to put together an arbitrary SQL statement in the JCA adapter
-
How to get this output using sql query?
Hi,
How to get this output using sql query?
Sno Name Age ADD Result
1 Anil 23 delhi Pass
2 Shruti 25 bangalor Pass
3 Arun 21 delhi fail
4 Sonu 23 pune Pass
5 Roji 26 hydrabad fail
6 Anil 28 delhi pass
Output
Sno Name Age ADD Result
1 Anil 23 delhi pass
28 delhi passHi Vamshi,
Your query is not pretty clear.
write the select query using Name = 'ANIL' in where condition and display the ouput using Control-break statements.
Regards,
Kannan -
How to hide repeated details using SQL Query?
How to hide repeated details using SQL Query?
For Ex:
------------------------+
DEPTNO| ENAME | JOB |
------|-------| --------|
10 | JAMES | MANAGER |
10 | BLAKE | CLERK |
10 | FORD | SALESMAN|
20 | SCOTT | MANAGER |
20 | ADAMS | CLERK |
20 | KING | SALESMAN|
------------------------+
How we can display the above details in the following way?
------------------------+
DEPTNO| ENAME | JOB |
------|-------| --------|
10 | JAMES | MANAGER |
| BLAKE | CLERK |
| FORD | SALESMAN|
20 | SCOTT | MANAGER |
| ADAMS | CLERK |
| KING | SALESMAN|
------------------------+
Thanks AdvanceHi,
you can use BREAK ON DEPTNO in SQL*Plus or use LAG.
SQL> ed
Wrote file afiedt.buf
1 select nullif(department_id
2 , lag(department_id) over (partition by department_id order by last_name)
3 ) dept_id
4 , last_name, job_id
5* from employees where department_id in (30,50) and rownum <=10
SQL> /
DEPT_ID LAST_NAME JOB_ID
30 Baida PU_CLERK
Colmenares PU_CLERK
Himuro PU_CLERK
Khoo PU_CLERK
Raphaely PU_MAN
Tobias PU_CLERK
50 Fripp ST_MAN
Kaufling ST_MAN
Vollman ST_MAN
Weiss ST_MAN
10 rows selected. -
How to retrive the blob data from a table using sql query
Hi gurus,
I have a table which has " BLOB "content in a column .I want to view the data From BLOB column using sql query .It would be helpfull If some one share their idea.
Regards,
vardhani.You can use data templates.
See this: http://blogs.oracle.com/xmlpublisher/entry/blob_clob_raw_and_looooong
http://blogs.oracle.com/xmlpublisher/entry/inserting_blobs_into_your_repo
Thanks,
Bipuser -
How to show the VALUE as the Column Header using SQL query?
Hi
I have a requirement to show the picked value as the column header using SQL query.
Example:
======
SELECT EMPNO FROM EMP
WHERE EMPNO=7934;
Result Should be:
7934
7934I have a requirement to show the picked value as the column header using SQL query.In sql*plus you can do
SQL> set verify on
SQL> def e = 7934
old: SELECT empno "&&e" FROM emp WHERE empno = &&e
new: SELECT empno "7934" FROM emp WHERE empno = 7934
SQL> SELECT empno "7934" FROM emp WHERE empno = 7934
7934
7934
1 row selected. -
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. -
How to compare result from sql query with data writen in html input tag?
how to compare result
from sql query with data
writen in html input tag?
I need to compare
user and password in html form
with all user and password in database
how to do this?
or put the resulr from sql query
in array
please help me?Hi dejani
first get the user name and password enter by the user
using
String sUsername=request.getParameter("name of the textfield");
String sPassword=request.getParameter("name of the textfield");
after executeQuery() statement
int exist=0;
while(rs.next())
String sUserId= rs.getString("username");
String sPass_wd= rs.getString("password");
if(sUserId.equals(sUsername) && sPass_wd.equals(sPassword))
exist=1;
if(exist==1)
out.println("user exist");
else
out.println("not exist"); -
Re: How to converting from PL/SQL query to T-SQL query
How to converting from PL/SQL query to T-SQL query... Its Urgent
Download the
SQL Server Migration Assistant for Oracle. It will convert whole Oracle databases, or single queries or PL/SQL stored procedures.
With caution that If your database is using Collation which is case sensitive SSMA will not work.SSMA doesnt guarantees 100% for conversion of Queries/stored proc /database if it fails to do so for some queries you will have to do it manually.
But you can try
Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers -
Information about constraints by using SQL query?
Hi
how can we view all the definition of a constraint by using SQL query.
Suppose I create following tables:
CREATE TABLE supplier
( supplier_id numeric(10) not null,
supplier_name varchar2(50) not null,
contact_name varchar2(50),
CONSTRAINT supplier_pk PRIMARY KEY (supplier_id, supplier_name)
CREATE TABLE products
( product_id numeric(10) not null,
supplier_id numeric(10) not null,
supplier_name varchar2(50) not null,
CONSTRAINT fk_supplier_comp
FOREIGN KEY (supplier_id, supplier_name)
REFERENCES supplier(supplier_id, supplier_name)
ON DELETE CASCADE
e.g. CONSTRAINT fk_supplier_comp: Plz write me the SQL query that tells that this is a FOREIGN KEY (supplier_id, supplier_name) and REFERENCES supplier(supplier_id, supplier_name) .....etc.
thanksYou mean "What is an Oracle Metalink?"
Then, Oracle Metalink (www.metalink.oracle.com) is an official web site of Oracle Corporation. This is the area where you can get an ultimate and immediate fixes for any sort of Oracle/Issues/Problems. And also, Patches/fixes/Notes/Procedures can be used as reference and can be downloaded from this.
Note: Sharing of Oracle Metalink information/credentials is highly illegal act.
Fore more information and benefits on Oracle Metalink, please take a look at the below URL.
http://www.oracle.com/support/premier/metalink.html
Regards,
Sabdar Syed. -
ReportViewer using SQL Query error states: Incorrect syntax near ','.
Hello Community
Using Visual Studio 2008 and SQL Server 2008 I created a Windows Application
that uses SQL Server Reporting Services. The application uses ReportViewer and
calls a method written using SQL query.
1-First I created the form.
2-Next I dragged the ReportViewer (Toolbox) and Table (from DataSource) onto the form.
The problem is that when it reaches the last line of the SQL query (ie, da.Fill(ds, "TableOne");)
the code fails stating the error message:
"Incorrect syntax near ','."
The following is the code behind the form containing the query:
private void ReportPgm1_Load(object sender, EventArgs e)
// TODO: This line of code loads data into the 'ReportDBDataSet.TableOne' table. You can move, or remove it, as needed.
this.TableOneTableAdapter.Fill(this.ReportDBDataSet.TableOne);
reportViewer1.ProcessingMode = ProcessingMode.Local;
LocalReport ReportOneLocalReport = reportViewer1.LocalReport;
DataSet ds = new DataSet("ReportDBDataSet.TableOne");
pgmReportOne(FromDate, ToDate, ds);
ReportDataSource ds = new ReportDataSource("ReportDBDataSet.TableOne");
ds.Value = dataset.Tables["TableOne"];
ReportOneLocalReport.DataSources.Clear();
ReportOneLocalReport.DataSources.Add(ds);
this.reportViewer1.RefreshReport();
private void pgmReportOne(DateTime FromDate, DateTime ToDate, DataSet ds)
SqlConnection connection = new SqlConnection("Data Source=ReportDBServer;Initial Catalog=ReportDB;Uid=sa;pwd=Password");
string sqlReportOne = "Select ([InDate], [FirstName], [LastName], [AGe]" +
"from TableOne";
SqlCommand command = new SqlCommand(sqlReportONe, connection);
command.Parameters.Add(new SqlParameter("paramFDate", FromDate));
command.Parameters.Add(new SqlParameter("paramTDate", ToDate));
SqlDataAdapter da = new SqlDataAdapter(command);
da.Fill(ds, "TableOne");
Why does the last line throw an error?
Thank you
Shabeaut--NOTE: The statement below cannot be run on SQL Server 2012
--If you have an earlier version and can set the compatibility
--level to 80, it can be run.
SELECT sso.SpecialOfferID, Description, DiscountPct, ProductID
FROM Sales.SpecialOffer sso,
Sales.SpecialOfferProduct ssop
WHERE sso.SpecialOfferID *= ssop.SpecialOfferID
AND sso.SpecialOfferID != 1
Hi Scott
The *= is old syntax and not compatible with SQL Server 2012 (as stated in the comments).
You could do something like this instead
SELECT sso.SpecialOfferID
,Description
,DiscountPct
,ProductID
FROM Sales.SpecialOffer sso
left outer join Sales.SpecialOfferProduct ssop on sso.SpecialOfferID = ssop.SpecialOfferID
WHERE sso.SpecialOfferID != 1
Maybe you are looking for
-
My airport extreme shows a green light, but won't connect to the internet.
I have an airport extreme, and it stopped working one day, so I reseted it and it's not connecting to the internet now. It's showing a green light, however, it won't connect to the internet. I live in an apartment complex, so I don't have a cable mo
-
How can I deactivate a product from a computer that is dead?
Hello, I am trying to install my Design Suite Premium onto a new computer. The only problem is that the 2 computers I installed it on are dead. I cannot even turn them on - one is a hard drive problem, the other was a 12 year old computer that will
-
Installing SOA 11g on Windows XP 64 bit
Hi! I wat to install Oracle SOA Suite 11g on Windows XP 64 bit. Probably I have to install separate 64 bit JDK? Are there any other tricks or issueses? Thx
-
Processing SELECT FOR UPDATE queries
Hello, Is there any occi sample code that uses "SELECT ... FOR UPDATE" and "WHERE CURRENT OF"?
-
Not able to edit info on downloaded torrents
This never used to be a problem but recently whenever I download music from a torrent site itunes doesn't let me change any information on the tracks. Track or album title, artist name, etc. Everything is greyed out when I go to info. I have to make