format sql accno
question: How can I format this number
Select employee acctno
bb0201938
display as
BB-010-1938
Existing account number format is always the same
If so just use SUBSTR function something like
SUBSTR (acctno, 1, 2). '-' || SUBSTR (acctno, 3, 3) | '-' || SUBSTR (acctno, 6, 4)
Tags: Database
Similar Questions
-
Reg: Custom formatting SQL Developer 4.1
Hi Experts,
I'm having a custom formatting. Has made some adjustments in Tools > Preferences > database > SQL Formatter but could not get it exactly like I want to.
SELECT t1.col1
T1.col2,
T1.col3,
T1. COL4,
T1.col5,
T1. OTP,
T2. FID,
T2. PID
FROM table_1 t1,.
table_2 t2,
table_3 t3
WHERE t1.rid = in_rid
AND t1.col5 = t2.lid
AND t1.col1 = t3.loid
AND t1.atp NOT AS "ABC%".
AND NOT EXISTS
(
SELECT t4.*
OF table_4 t4.
table_5 t5
WHERE t4.tid = t5.tid
AND t5.active = 'Y '.
AND t4.flag = CC_FLAG
AND t4.anw IS NULL
)
ORDER BY t1.col3;
(1) I want to put join conditions (red) highlighted in the next line after the WHERE clause. (Do not want to place it in line with WHERE)
(2) can we have another level of indentation (1 or 2 more tab-space) AND in the WHERE clause. (Don't want the AND and WHERE clauses to be on the same vertical line)
Is this feasible?
Thank you and best regards,
-Nordine
(1) Yes
(2) Yes
-
Hide the pause State Classic formatting SQL code?
Hi... I created the classic report with break formatting and cheked sum of columns breaked
It's the picture what it looks like:
http://ImageShack.us/f/24/examplewl.jpg/
Formatting break is to first colum (TC COMPANY) after first grouping column b amount (UKUPNO), and there at the end of the table on the next page he has SUM TOTAL.
I want to create in the iReport but it ' not possible to see the query SQL of APEX defined formatting break.
Does anyone now how exactly the same with the SQL query?Hello
You can use SQL as indicated below to get the desired results:
select 90 seq, empno, ename, hiredate, job, mgr, sal, comm, deptno from emp union all select 91 seq, null empno, null ename, null hiredate, null job, null mgr, sum(sal) sal, null comm, deptno from emp group by deptno union all select 92 seq, null empno, null ename, null hiredate, null job, null mgr, sum(sal) sal, null comm, 99 deptno from emp order by deptno, 1
I hope this helps.
Zahid
-
Hello everyone
I have 2 questions for charger
(1) I need to convert the date value in the csv file, column called closed_date and the value of the time to come as null and sometimes 20101122 22:12:07. I want to insert 'YYYYMMDD HH24:MI:SS' this format.
(2) when I try I load the clob data type column using sql loader its give without endpoints found for this column.
Could you please advice.
Thank you
Bhavanauser13689917 wrote:
HelloI am getting error below.
column AUTHOR_CLOSED_DATE.
ORA-01841: (full) year must be between-4713 and 9999 and not 0In the CSV file the AUTHOR_CLOSED_DATE value is a string NULL.
Which seems to indicate that data in the file (at least a part of it) does not follow the format you specified in your control file (and is NOT NULL).
Check the data (original file) as well as SQL loader logs.
-
Hello
How can I remove # of my report?
USED TABLESPACE (MB) (MB) TOTAL (MB) PER_FREE FREE
132 320 4 175 136 495 3 DLY_DATA %
7 621 749 8 370 9 CONFIG %
FDATA 210 299 4 234 214 533 2%
CONFIG_DATA 12 324 468 12 792 4%
3 793 303 4 096 7 CONFIG_IDX %
# 26 995 # 2% WEI_DATA
245 450 5 118 250 568 2 WEI_IDX %
172 8 180 4% HUMAN
1 474 24 1 498 2 TRON_INDX %
4 511 117 4 628 3 DBDAT %
149 442 6 704 156 146 4 TS_DATA %
105 434 2 610 108 044 2 TS_INDEX %
#! / bin/sh
sqlplus-s ${USER} < < HIC
the feeding off value
set linesize 100
set pagesize 200
#spool tablespace.alert
"TABLESPACE" format a20 column
"USED (MB)" format a10 column
column "FREE (MB)" format a10
"TOTAL (MB)" format a10 column
"PER_FREE" format a10 column
SELECT THE TABLESPACE F.TABLESPACE_NAME
TO_CHAR ((T.TOTAL_SPACE-F.FREE_SPACE),'999,999 ') 'USED (MB).
TO_CHAR (F.FREE_SPACE, '999 999') 'FREE (MB).
TO_CHAR (T.TOTAL_SPACE, '999 999') 'TOTAL (MB).
TO_CHAR ((ROUND ((F.FREE_SPACE/T.TOTAL_SPACE)*100)),'999')||' %' PER_FREE))
DE)
SELECT NOM_TABLESPACE,
ROUND (SUM (BLOCKS * (SELECT VALUE/1024))
V $ PARAMETER
(WHERE NAME = "db_block_size") / 1024)
) FREE_SPACE
FROM DBA_FREE_SPACE
GROUP BY TABLESPACE_NAME
) F
(
SELECT NOM_TABLESPACE,
TOUR TOTAL_SPACE (SUM (BYTES/1048576))
FROM DBA_DATA_FILES
GROUP BY TABLESPACE_NAME
1
WHERE F.TABLESPACE_NAME = T.TABLESPACE_NAME
AND (ROUND ((F.FREE_SPACE/T.TOTAL_SPACE)*100)) < 10;)
spool off
output
HIC
Published by: drbiloukos on 2 Μαρ 2011 11:22 πμFormat your column explicitly or use a larger numLargeur.
http://download.Oracle.com/docs/CD/B19306_01/server.102/b14357/ch12040.htm#i2699209
http://download.Oracle.com/docs/CD/B19306_01/server.102/b14357/ch12013.htm#SQPUG034 -
Question: How can format SQL result in specific order?
Hello
My table looks like this:
COLONNE_1 COLUMN_2 one CAT one dog two pig I would get the reqult as:
COLONNE_1 COLUMN_2
a cat, dog
two pig
Can someone tell me how interrogate who?
Thank you!
Hello
Try this
Select colonne_1, listagg (column_2, ',') within the Group (order of column_2) column_2
of looks
Colonne_1 group
-
How to set sql server date has time format
Dear Sir.
I used the windows 7 operating system.
I have work on scada software to explore siemens wincc.
I develop the report based on sql server work.
but the problem is when I put my system date in DDMMYYYY format, so my data was not stored in sql server.
but when
I put my system date in YYYYMMDD format, then my data stored in sql server.
so, how to change the date format sql server.
I am attaching screenshot (it is a red box, so this date format, I held DDMMYYYY)
Please give solution.
Abhijit Hello,
Thank you for visiting Microsoft Community and we provide a detailed description of the issue.
According to the description, I understand that you have a question setting SQL server date time format. When you try to set the system date format id ddmmy, the data are not stored in SQL server on the system.
To get more information about it, we have a dedicated forum where these issues are dealt with and would be better suited to the TechNet community.
Please visit the link below to find a community that will provide the best support.
I hope this information is useful.
Please let us know if you need more help, we will be happy to help you.
Thank you.
-
APEX 4.2 new feature: Format of Date SQL Workshop
Hi guys,.
APEX 4.2 new features presentation powerpoint (http://www.oracle.com/technetwork/developer-tools/apex/overview/apex-42-new-features-1867076.pptx) in the guarantee section (http://www.oracle.com/technetwork/developer-tools/apex/application-express/apex-presentations-1866619.html) lists a feature called:
Date format SQL Workshop
Does anyone know what it is? I can't find anything in the documentation.
Thank you
~ Dietmar.Hi Dietmar,
This is where you can change the attributes of the users (name, e-mail address, etc.) in Space Administration work and Administration of the Instance.
http://docs.Oracle.com/CD/E37097_01/doc/doc.42/e35129/aadm_users.htm#BABGEAJE
Joel
-
Migrate from SQL Developer to another machine with all parameters
Is there a documented way to migrate from SQL Developer to another machine? I want that all my preferences (format sql, shortcuts etc.) history of sql, user, etc. connections reports are available on the new machine.
I know how to export/import connections. But for the rest, the pointers appreciated. I'm moving from a Win 7 32 bit to Win 7 64-bit machine. SQL Dev version is 4.0.2.15.
Thank you
Manish
Move your user defined reports in folders. You can save each of them with a single click in this way - to the folder level.
We have a permanent application in the JDev team to build in the IDE, the ability to export/import settings.
You can retrieve the directory systemX.X.X.X on the application data directory and must have almost everything.
-
Convert to Oracle SQL to MS SQL
Hello
I use the following in Microsoft SQL Server for recordcount:
declare @today datetime
Select @today = convert (datetime, convert (varchar, GETDATE(), 112), 112)
SELECT COUNT (*) FROM TABLE1 WHERE COALESCE (MODIFIEDDATE, CREATEDDATE) < @today-120
How can I convert this Oracle script?MRP wrote:
HelloI use the following in Microsoft SQL Server for recordcount:
declare @today datetime
Select @today = convert (datetime, convert (varchar, GETDATE(), 112), 112)SELECT COUNT (*) FROM TABLE1 WHERE COALESCE (MODIFIEDDATE, CREATEDDATE)<>
How can I convert this Oracle script?
Try this:
select count(*) from table1 where nvl(modifieddate,createddate) < trunc(sysdate)-120
Edit: I did not bother to look what date format SQL server 112 - if it's something else that remove the component "hour" of the date, then you need to let us know.
Published by: WhiteHat on October 18, 2010 15:17
-
Please help me with this SQL query
I'm practicing of SQL queries and met one involving the extraction of data from 3 different tables.
The three paintings are as below
< pre >
Country
Location_id country
LOC1 Spain
loc2 England
LOC3 Spain
loc4 USA
loc5 Italy
loc6 USA
loc7 USA
< / pre >
< pre >
User
user_id location_id
loc1 U1
loc1 U2
loc2 U3
loc2 U4
loc1 U5
U6 loc3
< / pre >
< pre >
Publish
user_id post_id
P1 u1
P2 u1
U2 P3
P4 u3
P5 u1
P6 u2
< / pre >
I am trying to write a SQL query - for each country of the users, showing the average number of positions
I understand the logic behind all this that we must first consolidate all locations, and then the users in one country and then find the way to their positions.
But, I'm having a difficulty to this format SQL. Could someone help me please with this request.
Thank you.Select
Country.Country,
Count (*) Totalpostspercountry,
Count (distinct post.user_id) Totaldistincuserspercountry,
count (*) / count (distinct post.user_id) Avgpostsperuserbycountry
Of
countries, have, post
where country.location_id = muser.location_id
and muser.user_id = post.user_id
Country.country groupThe output is like this for your sample data - hope that's what you're looking for :)
COUNTRY, TOTALPOSTSPERCOUNTRY, TOTALDISTINCUSERSPERCOUNTRY, AVGPOSTSPERUSERBYCOUNTRY
In England, 1, 1, 1.
Spain, 5, 2, 2.5. -
Excuting multiple sql statements
Hi to everyone.
I am quite new to Oracle, even though I have a great experience with SQL and MySQL commands. I am facing a problem that I guess it's really Basic.
I got a dump of an Oracle database in a format .sql. I mean that the schema and data are built thanks to a large number of sql statements. In particular the schema is done by many 'create a table... '. «While the data are built through «insert into...» ». My need is to import these databases into a new Oracle Oracle 10 g XE database.
I installed it on a Debian system, and I can properly run a single SQL command both through the web interface http://localhost: 8080/apex and logging as user oracle through the name of sqlplus user/passwd command.
My problem is that the data is spread over approximately 12000 SQL «INSERT INTO...» "so all one by one run might be a bit boring :-)
< u > so I ask if there is a way to tell Oracle to execute multiple SQL statements he read a file (like MySQL for example). < /u >
I'm planning to write a script to do if there is no better way. I know there's no way to dump databases Oracle, but I can change the .sql format since it's the only one I had.in SQL * Plus you can run a SQL file with the start command or the abridged version: @
SQL> start filename.sql or SQL> @filename.sql
-
Filter the table break corresponding to the part of the column
Hello
JDeveloper Version 11.1.2.4.0.
I have a table with a filter. I need to make this filter to do the following:
select column1 from table where upper(column1) like upper ('%filterValue%')
(If in the column, I have a name of "Christopher" and I look in the filter of "Frank" I want the line with Christopher is put into correspondence.)
I have replace the getCriteriaItemClause like this:
public String getCriteriaItemClause(ViewCriteriaItem vci) { if (vci != null) { AttributeDef attrDef = vci.getAttributeDef(); String attrName = attrDef.getName(); if ("java.lang.String".equals(attrDef.getJavaType().getName()) && vci.getValue() != null) { String colName = vci.getViewCriteria().isCriteriaForQuery() ? vci.getColumnNameForQuery() : attrName; String filterVal = (String)vci.getValue(); String sql = "(UPPER(%s) like UPPER('%s%%'))"; String clause = String.format(sql, colName, filterVal); System.out.println(" The view criteria is overriden to: " + clause); return clause; } } return super.getCriteriaItemClause(vci); }
The display criteria replaced: (UPPER (Person.LAST_NAME) as UPPER ("Franck%%'))
I tried to do the SQL string to be ' (UPPER (%s) as SUPERIOR ('%%%')) ", but it does not work and gives me very strange and unexpected results.").
Kind regards
Pamela
Is not you the problem in how you build the qry sql? Have you tried something like:
String qwe = "Hello"; String xyz = "upper('%"+qwe+"%');";
It prints "upper ('%hello%');", which is what you want. Right?
-
Convert multiple lines in a row
Hello
DB version: 10.2.0.3
It's the entry
NAME Total Free ITEM1 150 50 ITEM2 200 175 Expected result:
Please tell how to get the result in format (SQL using case or nested case) below
(XXX_utilized columns is on Total - free)
ITEM1_TOTAL ITEM1_Utilized ITEM1_Free ITEM2_TOTAL ITEM2_Utilized ITEM2_Free 150 100 50 200 25 175 Kind regards
Veera
with
the entry like
("ITEM1" select name, 150 total, 100 50 used, free of all the double union)
Select 'ITEM2', 200, 25, 175 double
)
SELECT max (case name when total ' ITEM1' then end) item1_total,.
Max (case name when 'ITEM1' then used end) item1_utilized,.
Max (case name when free ' ITEM1' then end) item1_free,.
Max (case name when total ' ITEM2' then end) item2_total,.
Max (case name when 'ITEM2' then used end) item2_utilized,.
Max (case name when free ' ITEM2' then end) item2_free
Since the entry
ITEM1_TOTAL ITEM1_UTILIZED ITEM1_FREE ITEM2_TOTAL ITEM2_UTILIZED ITEM2_FREE 150 100 50 200 25 175 Concerning
Etbin
-
How can I check the NDP project duplicate name?
Hi allI would like to know how I can check the NDP duplicate project name? I find that some NDP is initiate serveral times with the same or similar user name name. Assuming that the name of the project was "Smart Pilot". I've always found that this project can type differently as "Smart DRIVER", "smart pilot" or even "Smart drivers. Assuming I want to validate all these name before saving by using validation or custom validation infrastructure. Is this possible?
Assuming that it was possible, can you please guide me on the way?
Thank you very much in advance for the entire response.
Phaithoon W.
Here is some examples of code for a fast validator. Note that this uses a hard coded English error message, rather than a translation. If you want to use translations instead, look at a few examples in the folder ReferenceImplementations\Validation\SourceCode\ReferenceValidation of the pack of extensibility and review the training of Validation as well as (in the ReferenceImplementations\Validation\Documentation folder).
Note that the code provided is only for demonstration purposes and is not supported by Oracle.
Classes:
using System; using System.Data; using System.Xml; using Xeno.Data.NPD; using Xeno.Prodika.Application; using Xeno.Prodika.Services; using Xeno.Prodika.Validation; using Xeno.Prodika.Validation.Validators; namespace Oracle.Agile.PlmProcess.Validation { public class NPDUniqueProjectNameValidatorFactory : XmlConfigValidatorFactoryBase { protected override IValidator Create_Internal(XmlNode configNode) { return new NPDUniqueProjectNameValidator(); } } public class NPDUniqueProjectNameValidator : BaseValidator { private const string sql = @"select 1 as dup from NPDPROJECTML where UPPER(title) = UPPER ('{0}') and FKPROJECT <> '{1}' and LANGID = {2}"; public override bool Validate(IValidationContext ctx) { var project = ctx.ValidationTarget as INPDProjectDO; bool hasDuplicate = false; string sqlToExecute = String.Format(sql, project.ProjectML.Title, project.PKID, UserService.UserContext.User.PreferredLanguage); using (IDataReader reader = AppPlatformHelper.DataManager.newQuery().execute(sqlToExecute)) { if (reader.Read()) { hasDuplicate = true; } } if (hasDuplicate) ctx.AddError(String.Format("A project already exists with the name '{0}'.", project.ProjectML.Title)); return hasDuplicate; } private IUserService UserService { get { return AppPlatformHelper.ServiceManager.GetServiceByType
(); } } } } Then, add the following to the ValidationSettings.xml file in config\Extensions:
1. Add the validator factory, with a reference name in the config:
2. Add a rule for NDP project save the event:
Compile the example reference in a dll and add this dll in web\npd\bin
When you try to save a project with a duplicate name, it should now give you the error message.
Maybe you are looking for
-
How to retrieve the information from the old account sync?
HARD drive died on me, but I don't think that it much of a problem, because I just thought that I would pair the new facility with my android phone. However, I would have noticed it much earlier than there are new accounts of synchronization and migr
-
What is the correct order to install Win7 to Satellite P750-103?
Hello I'm going to do a clean install on my laptop with Win7 x 64 and I would like to know if there is a specific order to install the driver and if there is a way to download all in one package (zip or other) or if I really need to download one at a
-
Save 1 array in a loop for the other run cycles.
I have a function built into a N = 65 for the loop that pulls down real-time data in table. On the first loop, a table for "calibration" is created that needs to be saved as a reference for measures in the next 64 executions. Anyone know what I ne
-
descargar programa Lenovo USB.2 UVC camera
Sea desahabilitado mi camara lenovo camera UVC USB.2 me podrán help a habilitarla desde su Sistema de Microsof
-
Can't log in as administrator! Impossible to change anything!
Okey, so I changed my standard account... it had been initially on administrator. I did this because whenever I did something he asked permission first... very annoying. But now, because my other user is admin, I can't do anything! My other user is a