Dumb double quote question in my SQL.
This maybe a dumb question, but I want the rownum to appear in my query output and not the word 'rownum' - what am I missing. Maybe one too many quotes or missing one somewhere.
select '**''9'',''f21'',''|| rownum - 1 ||''**' from dual;
I want this ==> **'9','f21','1'**
NOT this ==> **'9','f21','|| rownum - 1 ||'**
Cheers
John.
SQL> select '**'||'9'||','||chr(39)||'f21'||chr(39)||','||chr(39)||to_char(rownum-1)||chr(39)||''||'**' from dual
2 /
'**'||'9'||','||CHR(39)||'F21'||CHR(39)||','||CHR(39)|
**9,'f21','0'**But you will always get 0 rownum-1.
Khurram
Message was edited by:
Khurram Siddiqui
Similar Messages
-
Double quote encapsulated identifiers in sql developer 1.5.1
hello,
i migrated a mysql database to oracle using the sql developer 1.5.1 on linux. unfortunately i'm using some reserved words in my table name / columns. how is it possible to generate an import script that uses double quote encapsulated identifiers? in the migration workbench, there is an option named "Create ANSI-compilant names" which should do what i need, but i cannot find this option in sql developer.
thank you for your help. regards,
sebastianI'm not sure what your question is; Did you migrate successfully? How do you generate an import script? What is failing? Can you provide an example?
K. -
I've created an SSIS package to import a comma delimited file (csv) with double quotes for a text qualifier ("). Some of the fields contain the delimiter inside the qualified text. An example row is:
15,"Doe, John",IS2,Alabama
In SSIS I've specified the text qualifier as ". The sample output in the connection manager looks great. The package runs perfectly from VS and when manually executed on the SSIS server itself. The problem comes when I schedule the package to run via SQL
job. At this point the package ignores the text qualifier, and in doing so pushes half of a field into the next available column. But instead of having too many columns, it concatenates the last 2 columns ignoring the delimiter. For example (pipes are fields):
15|"Doe| John"|IS2,Alabama
So the failure happens when the last half of a field is too large to fit into the next available field. In the case above _John" is 6 characters where the IS2 field is char(3). This would cause a truncation failure, which is the error I receive from the
job history.
To further test this I created a failure flow in my data flow to capture the records failing to be pulled from the source csv. Out of ~5000 records, ~1200 are failing, and every one of the failures has a comma delimiter inside the quoted text with a 'split'
length greater than the next ordinal field. The ones without the comma were inserted as normal and records where the split fit into the next ordinal column where also imported, with the last field being concatenated w/delimiter. Example records when selected
from table:
25|"Allan Percone Trucking"|GI6|California --Imported as intended
36|"Renolds| J."|UI6,Colorado --Field position offset by 1 to right - Last field overloaded
To further ensure this is the problem, I changed the csv file and flat file connection manager to pipe delimited, and sure enough every record makes it in perfectly from the SQL job execution.
I've tried comma delimited on the following set ups. Each set up failed.
SSIS Server 2008 R2 RTM
DB Server 2008 RTM
DB Compat 80
SSIS Server 2008 R2 RTM
DB Server 2008 R2 RTM
DB Compat 80
SSIS Server 2008 R2 RTM
DB Server 2008 RTM
DB Compat 100
SSIS Server 2008 R2 RTM
DB Server 2008 R2 RTM
DB Compat 100
Since a lot of our data comes in via comma delimited flat files, I really need a fix for this. If not I'll have to rebuild all my files when I import them to use pipe delimiters instaed of commas. I'd like to avoid the extra processing overhead if possible.
Also, is this a known bug? If so can someone point me to the posting of said bug?
Edit: I can't ask the vendor to change the format to pipe delimited because it comes from a federal government site.Just wanted to share my experience of this for anyone else since I wasted a morning on it today.
I encountered the same problem where I could run the package fine on my machine but when I deployed to a server and ran the package via dtexec, the " delimeter was being replaced with _x0022_ and columns all slurped up together and overflowing columns/truncating
data etc.
Since I didn't want to manually hack the DTS XML and can't install updates, the solution I used was to set an expression on the textdelimiter field of the flat file connection with the value "\"" (a double quote). That way, even if the one stored in XML
gets bodged somewhere along the way, it is overridden with the correct value at run time. The package works fine everywhere now. -
Problem with SQL statement - Missing double quote in identifier
Hi
I am unable to run the following query in TOAD.
SELECT A.* FROM (SELECT VC.CAMPAIGN_NUMBER," +
"VC.CAMPAIGN_TITLE,VC.CAMPAIGN_DESC,VC.START_DATE,VC.END_DATE,VC.CAMPAIGN_TYPE,VC.APPLICABILITY," +
"VC.CAMPAIGN_PRIORITY FROM VM_CAMPAIGN VC WHERE VC.APPLICABILITY = 'Y' and VC.COUNTRY_CODE = ? " +
"and VC.LANGUAGE_CODE = ? AND VC.CAMPAIGN_TYPE = ? AND SYSDATE BETWEEN VC.START_DATE AND " +
"VC.END_DATE AND NOT EXISTS (SELECT 'X' FROM VM_CAMPAIGN_VIN VCV WHERE (VCV.VIN = ? AND " +
"VCV.CAMPAIGN_NUMBER = VC.CAMPAIGN_NUMBER))UNION SELECT VC.CAMPAIGN_NUMBER,VC.CAMPAIGN_TITLE," +
"VC.CAMPAIGN_DESC,VCV.START_DATE,VCV.END_DATE,VC.CAMPAIGN_TYPE,VC.APPLICABILITY,VC.CAMPAIGN_PRIORITY " +
"FROM VM_CAMPAIGN_VIN VCV ,VM_CAMPAIGN VC WHERE VCV.VIN = ? AND " +
"VCV.CAMPAIGN_NUMBER = VC.CAMPAIGN_NUMBER AND VC.COUNTRY_CODE = ? AND VC.LANGUAGE_CODE = ? AND " +
"VC.CAMPAIGN_TYPE = ? AND SYSDATE BETWEEN VCV.START_DATE AND VCV.END_DATE AND SYSDATE BETWEEN " +
"VC.START_DATE AND VC.END_DATE) A ORDER BY A.CAMPAIGN_PRIORITY DESC, A.END_DATE
I am getting "Missing double quote in identifier"
I am not sure how to rectify this SQL code. Any suggestions are welcome
thanks in advancemaybe this will work.
SELECT A.*
FROM (SELECT VC.CAMPAIGN_NUMBER,
VC.CAMPAIGN_TITLE,
VC.CAMPAIGN_DESC,
VC.START_DATE,
VC.END_DATE,
VC.CAMPAIGN_TYPE,VC.APPLICABILITY,
VC.CAMPAIGN_PRIORITY
FROM VM_CAMPAIGN VC
WHERE VC.APPLICABILITY = 'Y'
And VC.COUNTRY_CODE = '&country_code'
And VC.LANGUAGE_CODE = '&language_code'
AND VC.CAMPAIGN_TYPE = '&campaign_type'
AND SYSDATE BETWEEN VC.START_DATE AND VC.END_DATE
AND NOT EXISTS (SELECT 'X'
FROM VM_CAMPAIGN_VIN VCV
WHERE (VCV.VIN = &VIN AND
VCV.CAMPAIGN_NUMBER = VC.CAMPAIGN_NUMBER))
UNION
SELECT VC.CAMPAIGN_NUMBER,
VC.CAMPAIGN_TITLE,
VC.CAMPAIGN_DESC,
VCV.START_DATE,
VCV.END_DATE,
VC.CAMPAIGN_TYPE,
VC.APPLICABILITY,
VC.CAMPAIGN_PRIORITY
FROM VM_CAMPAIGN_VIN VCV,
VM_CAMPAIGN VC
WHERE VCV.VIN = &VIN
AND VCV.CAMPAIGN_NUMBER = VC.CAMPAIGN_NUMBER
AND VC.COUNTRY_CODE = '&country_code'
AND VC.LANGUAGE_CODE = '&language_code'
AND VC.CAMPAIGN_TYPE = '&campaign_type'
AND SYSDATE BETWEEN VCV.START_DATE AND VCV.END_DATE
AND SYSDATE BETWEEN VC.START_DATE AND VC.END_DATE) A
ORDER BY A.CAMPAIGN_PRIORITY DESC, A.END_DATE -
SQL Loader - double quote within data
Hi,
I'm putting together some SQL loader scripts to load source data into a DB. The data we are receiving is comma delimited, optionally enclosed by double quotes (").
e.g. "abc","123","this is a "test"","987"
The problem I've got is that some data items contain double quotes ("test") as part of the data and this cause the SQL Loader to fall over with the error:
Record 14644: Rejected - Error on table x, column y.
no terminator found after TERMINATED and ENCLOSED field
Is it possible to load this without changing the extraction process from the source system?
My .ctl file looks like this:
LOAD DATA
INFILE '../data/toload/BR_ADDRESS.CSV'
APPEND INTO TABLE STA_COMP_BRADD
FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"'
etc....
Message was edited by:
MaximumStaggHi,
Look in to this in Oracle documentation:
"If two delimiter characters are encountered next to each other, a single occurrence of the delimiter character is used in the data value. For example, 'DON''T' is stored as DON'T. However, if the field consists of just two delimiter characters, its value is null."
http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_field_list.htm
Thanks,
Kishore -
Double Quotes Display Question Marks
I have some data in a tabe that is rendered as some read only output in my JHS app. This works fine in JDeveloper on Linux and JDeveloper as well as deployed on Windows. However in the version that is deployed on Red Hat the double quotes are not displaying correctly and instead display question marks in their place. The import of the database schema worked and the data is in fact double quotes. Wondering what setting I can change that makes this server treat the same data as the other environments?
Hi,
This sounds like a JDeveloper/ADF issue that is not related to JHeadstart. Can you please ask this question at the JDeveloper forum at JDeveloper and ADF ? Thanks!
Regards,
Evert-Jan de Bruin
JHeadstart Team -
PL/SQL: quoting problems (double quotes within PL/SQL, howto?)
Hello,
I have a big problem with that: I just cannot use execute immediate to do what I want.
The goal is that another user than sysdba needs to be able to open/close the wallet (we are sysdba and our client doesn't want us to be able to open the wallet, and we don't want the client to have sysdba), so I take advantage of the fact that procedures are executed by default with the privileges of the user which writes it. So, I try and create a PL/SQL procedure as sys and grant execute rights to the client user.
To open/close a wallet, the command is:
alter system set encryption wallet open/close identified by "thepasshere";
Note the double quotes... They are the problem here (passwords are mixed case and contain special characters). Right now, the only solution I came up with is:
create or replace procedure open_wallet (passwd in varchar2) is
begin
execute immediate 'alter system set encryption wallet open identified by "' || passwd || '";';
end;
But that's vulnerable to code injection... So, instead, I tried:
create or replace procedure open_wallet (passwd in varchar2) is
cmd varchar2(512);
begin
cmd != 'alter system set encryption wallet open identified by ":1"';
execute immediate cmd using passwd;
end;
which yields "ORA-00911: invalid character" - uh?
Now, if I try:
create or replace procedure open_wallet (passwd in varchar2) is
cmd varchar(512);
begin
cmd := 'alter system set encryption wallet open identified by :1;';
execute immediate cmd using passwd;
end;
it answers "ORA-28357: password required to open the wallet"
Aaargh! I see no way around that :(
Is there a solution at all?Did you try including the double quotes in the password bind value? Either when you pass the value in or by adding it in the routine.
create or replace procedure open_wallet (passwd in varchar2) is
cmd varchar(512);
pass varchar(512);
begin
cmd := 'alter system set encryption wallet open identified by :1;';
pass := '"' || passwd || '"';
execute immediate cmd using pass;
end; -
We are using MS Outlook 2010 as our mail client. But we have noticed that whenevr we sent a mail to any other internet mail recipient all the "apostrophe", "single" and "double quotes" have automatically converted to ?. We have
done almost all the workaround found in this site such as
1.New a message and focus on the message window > click File > Options > Mail > Spelling and Autocorrect… > Proofing > AutoCorrect Options… > AutoFormat > clear the box before “Straight quotes” with “smart quotes”
2. Used different encoding. We presently using US-ASCII for outgoing message. etc.
Need your help to sort out these issues urgently.
Waiting for a solution.Hi,
What is your account type? IMAP, POP or Exchange?
Send an email from the webmail, ask the recipient if this issue persists.
As far as I know, this problem is always related to the encoding for outgoing messages, and here I suggest you try UTF-8:
Go to File -> Options -> Advanced -> International options -> Uncheck "Automatically select encoding for outgoing messages", then select "Unicode (UTF-8)" beside "Preferred encoding for outgoing messages" -> OK.
Hope this helps.
Regards,
Melon Chen
TechNet Community Support -
Javascript Question - Will backslash work on double quotes
I think the term is escape
Will a backslash work on double quotes same as it does on a single quote
to display the quote marks which are contained within a javascript?
For example: an \"everyman\'s\" processyes
E. Michael Brandt
www.divahtml.com
www.divahtml.com/products/scripts_dreamweaver_extensions.php
Standards-compliant scripts and Dreamweaver Extensions
www.valleywebdesigns.com/vwd_Vdw.asp
JustSo PictureWindow
JustSo PhotoAlbum, et alia -
SQL Loader: double quotes inside double quotes
Hello,
I need to find a solution for loading some data that contains double quotas. The csv contains data like:
"1";"Name1";"Name2"
"2";"Name3 "another thing here"";"Name4"
"3";"Name33 "thing here"";"Name "name" Name"
The data inside the " " must be loaded exactly as it is, that means that in the DB, for row2, column2 the data must be: Name3 "another thing here". I cannot remove the qoutes.
the CTL:
LOAD DATA
CHARACTERSET AL32UTF8
INTO table table_name
APPEND
FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\"'
TRAILING NULLCOLS
Column1,
Column2,
Column3
Could anyone help on this?try with this ctl
LOAD DATA
CHARACTERSET AL32UTF8
INTO table table_name
APPEND
FIELDS TERMINATED BY ';' ENCLOSED BY '"'
TRAILING NULLCOLS
Column1,
Column2,
Column3
)also refer to
here and here
for detailed explanations and instructions -
8.1.7 jdbc driver: object types with double quotes
Hi all,
While switching from 8.1.6 to 8.1.7 I have trouble with the jdbc driver. It doesn't work
as before: The function CallableStatement.registerOutParameter (and probably some other) doesn't take object type
names in double quotes anymore. A test program is appended to this message. Using a 8.1.6 jdbc driver this program works fine but with a 8.1.7 jdbc driver it throws an exception.
My questions are: Is this bug already filed?
Is a bugfix already available somewhere?
Thanks in advance for any information
Joerg
import java.sql.*;
* create type "test_t" as object (atrb number(10));
* create table "test" of "test_t" (atrb not null) oidindex();
class test
public static void main (String args [])
throws SQLException
String s = "begin insert into \"test\" t values (1)" +
" returning ref(t) into ?; end;";
try{
DriverManager.registerDriver(new
oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection
("jdbc:oracle:thin:@host:1521:orcl","joerg", "password");
CallableStatement cs = conn.prepareCall( s );
cs.registerOutParameter(1, Types.REF, "\"test_t\"");
cs.execute();
System.out.println("Statement returned:");
System.out.println( cs.getObject(1) );
cs.close();
conn.commit();
conn.close();
catch(SQLException e){
System.out.println("SQLException was thrown...");
System.out.println(e.getMessage());
}I believe that typenames are always treated as case sensitive (unless they are all uppercased).
In your example you should write:
cs.registerOutParameter(1, Types.REF, "test_t");
If you had declared the type test_t in a case insensitive way (without "..."), then you'd have to write:
cs.registerOutParameter(1, Types.REF, "TEST_T");
If you have a schema-qualified name, use a ".":
cs.registerOutParameter(1, Types.REF, "SCOTT.test_t");
However, this behavior implies that you cannot use "." inside of quoted identifier names. -
Hi,
How to include double quotes in a update statement?
UPDATE sampletable
SET description = '<p style="font-weight: bold; color:Red;"> Message to Employee </p>'
WHERE empid = 1;
Expected output with I query table,
select description from sampletable WHERE empid = 1;
<p style="font-weight: bold; color:Red;"> Error Message </p>
Table definition:
sampletable
empid number
description varchar2(200)
ThanksPlease use the {noformat}{noformat} tag at the beginning and end of your examples.SQL> create table sampletable( empid number, description varchar2(2000));
Table created.
SQL> insert into sampletable values (1, null);
1 row created.
SQL> UPDATE sampletable
2 SET description = '<p style="font-weight: bold; color:Red;"> Message to Employee </p>'
3 WHERE empid = 1;
1 row updated.
SQL> select * from sampletable;
EMPID
DESCRIPTION
1
<p style="font-weight: bold; color:Red;"> Message to Employee </p>
Your question is not clear: why are you expecting "Error Message" instead of "Message to Employee"?
What do the double quotes have to do with it? -
Missing double quote in identifier help!
Hi there I need help with fixing this code, im trying to display the total of employees for Job title and location and its giving me a message saying" missing double quote in identifier" , please help, THANKS
SELECT j.job_title, “Job Title”,
l.city “Location”
e.employee_id “Employees ID”
COUNT(*) "No of Employees"
FROM hr.jobs j , hr.locations l,hr.employees eHi,
I suspect you might have more success if your replaced your open and close double quotes (i.e. “ and ”) by standard double quotes (").
This is the forum for the SQL Developer Data Modeler product. You're more likely to get an answer to this sort of question if you post on the SQL and PL/SQL forum: https://forums.oracle.com/forums/forum.jspa?forumID=75
David -
SSRS Report Returning Double Quote string from a Single Quote String
Hi, I'm getting weird thing in resultset from SSRS report when executed. When I pass parameter to a report, which passes String that has single quote value to a split function , it returns rows with double quote.
For example following string:
'N gage, Wash 'n Curl,Murray's, Don't-B-Bald
Returns:
''N gage, Wash ''n Curl,Murray''s, Don''t-B-Bald
through SSRS report.
Here is the split function Im using in a report.
CREATE Function [dbo].[fnSplit] (
@List varchar(8000),
@Delimiter char(1)
Returns @Temp1 Table (
ItemId int Identity(1, 1) NOT NULL PRIMARY KEY ,
Item varchar(8000) NULL
As
Begin
Declare @item varchar(4000),
@iPos int
Set @Delimiter = ISNULL(@Delimiter, ';' )
Set @List = RTrim(LTrim(@List))
-- check for final delimiter
If Right( @List, 1 ) <> @Delimiter -- append final delimiter
Select @List = @List + @Delimiter -- get position of first element
Select @iPos = Charindex( @Delimiter, @List, 1 )
While @iPos > 0
Begin
-- get item
Select @item = LTrim( RTrim( Substring( @List, 1, @iPos -1 ) ) )
If @@ERROR <> 0 Break -- remove item form list
Select @List = Substring( @List, @iPos + 1, Len(@List) - @iPos + 1 )
If @@ERROR <> 0 Break -- insert item
Insert @Temp1 Values( @item ) If @@ERROR <> 0 Break
-- get position pf next item
Select @iPos = Charindex( @Delimiter, @List, 1 )
If @@ERROR <> 0 Break
End
Return
End
FYI: I'm getting @List value from a table and passing it as a string to split function.
Any help would be appreciated!
ZKAnother user from TSQL forum posted this code which is returning the same resultset but when I execute both codes in SQL server it works and return single quote as expected.
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/8d5c96f5-c498-4f43-b2fb-284b0e83b205/passing-string-which-has-single-quote-rowvalue-to-a-function-returns-double-quoate?forum=transactsql
CREATE FUNCTION dbo.splitter(@string VARCHAR(MAX), @delim CHAR(1))
RETURNS @result TABLE (id INT IDENTITY, value VARCHAR(MAX))
AS
BEGIN
WHILE CHARINDEX(@delim,@string) > 0
BEGIN
INSERT INTO @result (value) VALUES (LEFT(@string,CHARINDEX(@delim,@string)-1))
SET @string = RIGHT(@string,LEN(@string)-CHARINDEX(@delim,@string))
END
INSERT INTO @result (value) VALUES (@string)
RETURN
END
GO
ZK -
How to globally change straight double quotes to curly open and close?
I am editing with InDesign (5.5) some documents created by others. I suddenly noticed that the double quote marks were straight, not curly, in one document and Find/Change does not seem to offer and option to distiguish the open (left) double quote mark from the right (close) when starting with double straight quotes. Any suggestions?
And--unrelated--why is so hard to get to a page where you can actually post a question?
Thanks!
JillSince the position of a double quotation mark determines its shape, it is easiest to use GREP with Find/Change. You can (1) find a straight quotation mark at the beginning of a word/phrase and change it to left quotation marks, and then (2) find a straight quotation mark at the end of a word/phrase and change it to right quotation marks.
(1)
Find what:
~"([\l\u\)[:punct:]])
This finds a straight quotation mark in front of any character or punctuation.
Change to:
\x{201C}$1
This puts a left quotation marks in front of what was behind the straight quotation mark.
(2)
Find what:
([\l\u\)[:punct:]])~"
This finds a straight quotation mark behind any character or punctuation.
Change to:
$1\x{201D}
This puts a left quotation mark behind what was behind the straight quotation mark.
I would find/change the first hits one at a time, and when you are confident that it works for your documents, go ahead and Change All.
Maybe you are looking for
-
FUNCTION-BASED INDEX ( ORACLE 8I NEW FEATURE )
제품 : ORACLE SERVER 작성날짜 : 2004-08-16 FUNCTION-BASED INDEX ( ORACLE 8I NEW FEATURE ) ============================================== SCOPE 10g Standard Edition(10.1.0) 이상 부터 Function-based Index 기능이 지원된다. Explanation 1. 개요 Function-based index는, 함
-
Settings for datasource 2LIS_02_ITM in R/3?
Dear Friends, I am preparing the datasource 2LIS_02_ITM in R/3 for data extraction and the SAP Library shows that there are some prerequisites for using this datasource. The following settings (as below) need to need to be made in R/3. Can somebody e
-
DPM 2012 - Protect Exchange 2007 in untrusted domain (either via Creds or Certificates)
Hi, I am trying to protect an Exchange 2007 Server which is in an untrusted domain. I have tried using both credentials (isNonDomainServer) and via Certificates and have no joy. Both methods work in terms of getting the agent installed and communica
-
Does EMOD email editor support CSS?
I've been trying to use CSS styles to format the HTML email template for EMOD and it seems to work in HTML Edit, but once I switch to HTML Preview, all CSS styles are lost and even removed from my code. Is this because EMOD does not support CSS and i
-
How to make a scrollable applet
How do I make an applet scroallable? Not a scrollpane within an applet but instead make the whole contentpane for the applet as a scrollable pane if the content within the applet�s contentpane is too small to view all the added content. Or if the app