SQL & PL/SQL :: Show Value Of Variable In Double Quotes?

Dec 4, 2011

declare
v_a varchar2(2000) := 'abcd';
v_e varchar2(2000) := '6666';
v_d varchar2(2000) := 'example';
v_final varchar2(4000);
begin
v_final := '"v_a"'||'''|'''||'"v_e"'||'''|'''||'"v_d"';

-- v_final := '"v_a"';

dbms_output.put_line('v_final: '||v_final);

end;
/

above gives me :

v_final: "v_a"'|'"v_e"'|'"v_d"

so it is printing the variable names, But I want to see values, like this: "abcd"|"6666"|"example"

View 6 Replies


ADVERTISEMENT

Server Utilities :: Loading String Has Double Quotes In It?

Aug 22, 2013

I am loading .csv file into Oracle using sql loader file has strings, and numberics, Strings are surrounded by double quotes(") and field terminated by comma(,)

load data
BADFILE '/var/opt/app/bad/filename'
DISCARDFILE '/var/opt/app/discard/filename'
append into table source_file
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS

Some time String fields may have double quotes in it, at that time it is rejecting the records. how to handle those records to load into table.

View 3 Replies View Related

SQL & PL/SQL :: Remove Spaces By Excluding Double Quotes From A String

Oct 29, 2012

I want to remove more than one space from a string by excluding double quotes.

For example:

I/P: Item .getChildByType(" Agreement").getParent( ) .hasChildByType("Agreement ")

O/P : Item.getChildByType(" Agreement").getParent().hasChildByType("Agreement ")

View 17 Replies View Related

SQL & PL/SQL :: Double Quotes In Column Name Can Be Replaced With Alternate Character?

Feb 14, 2012

Any way to replace the Double Quotes used to enclose column names with an alternative character. This is the SQL I have now that Works!

select (case when CUST is null then "/BIC/Z_SUPPLNT" else NM1 end) CMPNTSUPSRCE
from TBL1, TBL2
where "/BIC/Z_MAJVEND"=CUST(+) and Material = '1ABCD456'
order by Material

But would like to do something along these lines below but keep getting error "ORA-00936: missing expression".

select (case when CUST is null then chr(34)||/BIC/Z_SUPPLNT||chr(34) else NM1 end) CMPNTSUPSRCE
from TBL1, TBL2
where chr(34)||/BIC/Z_MAJVEND||chr(34)=CUST(+) and Material = '1ABCD456'
order by Material

View -1 Replies View Related

Server Utilities :: SQL Loader Loads All Fields With Double Quotes Into Staging Table

Aug 25, 2010

I am having a similar problem like above ONLY in UNIX box where my datafile is delimited by "|". The last field is ITM_CMNT declared as VARCHAR2(60) in Oracle. When I have exactly 60bytes in the last field it rejects the record saying actual 61 and max allowed is 60. If i reduce it to < 60bytes then it is stored as a value enclosed with double quotes. The enclosing double quote is on the next line.

"PROC,RAM,FLPY,HD,ACT MTX CLR DSP,D/PCMCIA,TRKBAL,LIT ION BA"

Expected: the one below is exactly 60bytes.

PROC,RAM,FLPY,HD,ACT MTX CLR DSP,D/PCMCIA,TRKBAL,LIT ION BAT
LOAD DATA
INFILE *
INTO TABLE TMPTLI_LAWSON_ITM_MST
TRUNCATE
FIELDS TERMINATED BY "|"
(ITM_NO, HAZ_MAT_CD, ITM_SHRT_DS, ITM_SON "TRIM(:ITM_SON)", ADDED_DT DATE "YYYY-MM-DD",
AVL_CD , ITM_CST_AMT, ITM_SLL_AMT,
EXCHG_PRC_AMT , ITM_UOM "TRIM(:ITM_UOM)",
PCK_QTY INTEGER EXTERNAL, SPC_HNDL_CD "TRIM(:SPC_HNDL_CD)", EFF_DT DATE "YYYY-MM-DD",
ITM_CMNT "TRIM(:ITM_CMNT)")

View 4 Replies View Related

Application Express :: To Change The Default Behavior Of Hide / Show Region To Show

Jun 26, 2012

I am trying to change the default behavior of Hide/Show Region to show, after some attempts i got it partially working but now clicking the icon to toggle hide/show doesn't work also changed the icons and added type="" but its not working.

View 16 Replies View Related

SQL & PL/SQL :: Double Right Outer Join

Oct 12, 2011

I have a query which does a double right outer join, and I need it to be rewritten using the newer syntax.

The previous query had the following clause:

WHERE
MOD_INFO.MODIFICATION_ID (+)= MOD.ID
AND MOD.PEPTIDE_ID (+)= PEPTIDE.ID

Or you can think of it generically as:

T1.T2_FK (+)= T2.ID AND
T2.T3_FK (+)= T3.ID

How would this be written using the newer syntax?

View 6 Replies View Related

SQL & PL/SQL :: Finding Double Vowels

Dec 14, 2010

I am reading Section 4-8 (page 42/216) in the Oracle Database 2-day Developer Guide from here:

[Code]....

It reads:

Suppose that you want to select every employee whose last name has a double vowel(two adjacent occurrences of the same vowel).

Example 4.9 shows how you can do this.

The regular expression ([AEIOU]) represents any vowel. The metacharacter 1 represents the first (and in this case, only) regular expression. The third function parameter, 'i', specifies that the match is case-insensitive.

Example 4.9 Selecting All Employees Whose Last Names Have Double Vowels

SELECT FIRST_NAME, LAST_NAME
FROM EMPLOYEES
WHERE REGEXP_LIKE(LAST_NAME, '([AEIOU])1', 'i');

Result is similar to:

FIRST_NAME LAST_NAME
-------------------- -------------------------
Harrison Bloom
Lex De Haan
Kevin Feeney
Ki Gee
Nancy Greenberg
Danielle Greene
Alexander Khoo
David Lee

8 rows selected.

I don't understand how [AEIOU])1 would find a double vowel(two adjacent occurrences of the same vowel).

View 6 Replies View Related

PL/SQL :: Representing Double Space?

Aug 20, 2012

i'm trying to read a text file into an oracel table. I'm having issues with this statement FIELDS TERMINATED BY ' ' fields are separated by 2 spaces. How ever Oracle is not recognizing ' ' or " " as double space. It is treating as one space thus shifting all coulmns.

How can I represent double space to Oracle ?

View 12 Replies View Related

SQL & PL/SQL :: Insert String Having Two Double Quote?

Nov 10, 2010

i have table contains a column of var char type i want to insert a value

'1 mmTHICK GI SHEET 4' X 8' X 1MM THICH' in to the coulmn but m getting error

I tried set scan off but its not worrking for the below query.

ERROR at line 1:
ORA-00923: FROM keyword not found where expected

my query is
Insert into Inventory select
'N1280000015',
'1 mmTHICK GI SHEET 4''' X 8''' X 1MM THICH',

[code]....

View 8 Replies View Related

SQL & PL/SQL :: Display A Value In Between Single Quotes?

Nov 18, 2011

how to write a select query to display a number column value in between single quotes. Ex:i have a emp table in that sal column is a number type.

Ex:
select sal from emp;
sal
----
1234
231
3456
3211
23445I want to display the same above result in b/w single quotes.

ex:
sal
----
'1234'
'231'
'3456'
'3211'
'23445'
for this i need to write a query,

View 5 Replies View Related

SQL & PL/SQL :: Using Apostrophe / Quotes In A String

Feb 9, 2011

Here is a sample function which takes in a string of CSV fields and prints the third field :

create or replace function restr(istr varchar2) return INTEGER
is
var_1 varchar2(30);
begin
dbms_output.put_line('input:'||istr);
select regexp_substr(',' || istr,1,3,null,1) into var_1 from dual;

[Code]..

When I pass an input string as :

JOHN,MARY,O'DONNEL,O'CONNELLY,MARK

with quotes/apostrophe in it to the function then it prints the input string in the first dbms_output but errors out at the select with ORA-01760.

how we can use the quote/apostrophe character here ?

View 6 Replies View Related

SQL & PL/SQL :: Inserting Single Quotes

Dec 4, 2012

I have a string: 'VOLT,AGE'..

How can I convert this string to: 'VOLT','AGE' using REGEXP_REPLACE...

I am having trouble escaping the single quotes in my query

View 6 Replies View Related

PL/SQL :: Embedding Quotes In Strings?

Aug 16, 2013

In the code segment below (hope it appears right) I can understand the use of single quotes in the first two examples but in the third example below I had to use double quotes around the word - Today's - and I not sure I understand why?! I'm aware of the rules ...If you want a single quote to appear in the middle of a string add another single quote to it.If you want a single quote to appear at the beginning or end of a string add 2 single quotes to it.If you want a single quote to appear on its own add 3 single quotes to it. 

SQL> select 'This isn''t' from dual;
'THISISN''
----------
This isn't
SQL> select to_number('34@456#789', '999G999D999', 'nls_numeric_characters=''#@'' ') from dual;
TO_NUMBER('34@456#789','999G999D999','NLS_NUMERIC_CHARACTERS=''#@''')
---------------------------------------------------------------------
                                                            34456.789
SQL> select to_char(sysdate, 'fm"Today''s" ddth Month YYYY') from dual;
TO_CHAR(SYSDATE,'FM"TODAY''S"DDTHMONTHYYYY')
------------------------------------------------------
Today's 16th August 2013

View 12 Replies View Related

SQL & PL/SQL :: Procedure To Update Double Subcategory Sequence

Dec 6, 2010

I need to write a procedure to be able to reuse it to clean up subcategory sequence. Here is a problem: two tables: Category and subcategory:

create table Category
(category_id number,
Name varchar2(20))
/
create table Sub_Category
(sub_category_id number,
category_id number,
sequence number)
/

In the ideal world each subcategory of a single category would have unique sequence so if there are 3 subcategory for the same category then each of them would have 1,2,3 in sequence, if there are 5 subcategories then 1,2,3,4,5 for each of them etc.

Problem I'm facing is that some of the subcategories sequences for the same category has the same values . For instance for 4 subcategories of the same category, each of them has 1 (1,1,1,1) in a sequence.

So ideal world is :

Insert into Category values (123 ,'Category1');
Insert into Category values (234 ,'Category2');
Insert into Category values (345 ,'Category3');
Insert into Category values (456 ,'Category4');
Insert into Category values (567 ,'Category5');
Insert into Sub_Category values (1,123,1);
Insert into Sub_Category values (2,123,2);
Insert into Sub_Category values (3,123,3);

But I've also bad rows like this:

Insert into Sub_Category values (4,234,1);
Insert into Sub_Category values (5,234,1);
Insert into Sub_Category values (6,234,1);
Insert into Sub_Category values (7,345,1);
Insert into Sub_Category values (8,345,1);
[code].....

Fix for this and my goal is to select all such cases where subcases have mixed up sequences as above and give them randomly numbers starting from 1. So if there are 3 subcategories like for CATEGORY 2 then just apply random number to the sequence of the subCATEGORIES like 1,2,3. For CATEGORY 3 : 1,2,3 to 7.

I was thinking to write two procedures one selecting all the categories and passing category ID to the other procedure that would actually update sequence, like this:

CREATE OR REPLACE PROCEDURE SCHEMA.SELECT_CATEGORY
IS
CURSOR c1
IS
select category_ID from category where ...;
BEGIN
FOR a IN c1 LOOP
UPDATE_SUBCATEGORY(a.Category_id);
COMMIT;
END LOOP;
END;
/

And the actual procedure updating subcategory:

CREATE OR REPLACE PROCEDURE SCHEMA.UPDATE_SUBCATEGORY
BEGIN
............
END;
/

write PROCEDURE SCHEMA.SELECT_CATEGORY cursor to not miss any of the categories ID having mixed up subcategory. There can be any of the doubled sequences like doubled 1 value (this is majority) but there can be any other doubles (or at least I need to make sure that there aren't any other doubles 2 values or 3 values in sequence etc.)

And how to write SCHEMA.UPDATE_SUBCATEGORY to loop through rows of subcategory and update sequence with values starting from 1 ?

View 17 Replies View Related

SQL & PL/SQL :: Column Type For Double Byte And Image

Apr 29, 2010

I have oracle 10g database running on Sun Solaris. My database character set is AL32UTF8. Our user wants to store a double byte character and an image, I want to know what the column type should be using for these.

View 2 Replies View Related

Forms :: Printing Double-Sided Using SET_REPORT_OBJECT_PROPERTY?

Jun 9, 2010

I support old oracle code and we currently print using the set report object property.

I recently was requested to modify all of our printing to two-sided printing from the current one page per sheet.

I am trying to figure out if there is a parameter I can set, i.e.REPORT_OTHER or something else that would allow me to do this.

View 4 Replies View Related

SQL & PL/SQL :: Concatenate A Comma But Not Single Quotes

Oct 8, 2010

In table_A , the primary key is Col_A which is of data type number.I want to concatenate it with ' '

Col_A
______

123
124

select '|| col_A ||'||','
from
Table_A;

The output should be
'123',
'124'

I can concatenate a comma but not single quotes.

View 3 Replies View Related

How Many Quotes To Use In Dynamic Query Using IN Clause With String

Nov 23, 2011

I have a dynamic query which has this clause in it: WHERE [COLUMN NAME] IN (' || theString || ')

My problem is that theString is being passed in through a C# call and the variable is a bunch of strings concatenated together and separated by a comma. Ex: theString = "'val1','val2'"

How many quotes are supposed to go around val1 and val2?

I've tried the following and none work:
'val1','val2'
''val1','val2''
''val1'',''val2''
'''val1'',''val2'''
''''val1'',''val2''''

When I run the procedure in Oracle it works with '''val1'',''val2'''

View 1 Replies View Related

PL/SQL :: SYSDATE In DDMMYYYY Inside Single Quotes

Dec 4, 2012

I have a requirement like:

Create Table A
( a number,
CreationDate DATE)
PARTITION BY RANGE (CreationDate)
(
Partition p_03122012 VALUES LESS THAN (TIMESTAMP' 2012-12-04 00:00:00'),

[Code]...

NOTE: Partition are named as p_ddmmyyyy where ddmmyyyy is date.

select * from dba_tab_partitions where table_name = 'A'

Now my requirement is :

select * from dba_tab_partitions where table_name = 'A' and partition_name > 'p_ddmmyyyy' (Here I want ddmmyyyy to be from sysdate i.e. date we get from - Select to_char(sysdate,'ddmmyyyy') from dual
i.e. for today it becomes
select * from dba_tab_partitions where table_name = 'A' and partition_name > 'P_04122012'

So it returns me two rows.

How can I do it in single quotes.

View 6 Replies View Related

SQL & PL/SQL :: Adding Quotes Around Field Only If Comma Exists Within

Mar 25, 2010

I searched the forum but could not find an answer. I am creating an extract via SPOOL that will send the output to a CSV file. I am comfortable concatenating commas in between the fields, the problem lies in text fields such as last_name which may contain a comma. The requirements of my client state to put double quotes around text fields ONLY if they contain a comma (so as not to throw off the CSV file obviously).

The only thing I could think of was a nested DECODE checked every character of every text field for a , and if it finds one to put " and if not to put nothing. This would get very tedious to program it as there are many text fields and they can be very long. I may even run out of nested DECODE statements (I forget what the limit is now).

View 9 Replies View Related

Server Utilities :: Sql Loader / How To Ignore Error Due To Quotes

May 5, 2010

I have control file written like

LOAD DATA
APPEND
INTO TABLE MYTABLE
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS

but i have data in csv file like

660501,1,"0187591","12"PEGHOOKW/SA",,"04/03/2002",

Since there is an extra double quote (denoting inch) in the third column, im getting an error. Is there any way to avoid this error without modifying the csv file.

View 10 Replies View Related

SQL & PL/SQL :: Replace Double Space With Single Space And Also Remove Junk Characters

Jul 1, 2013

I want to replace double space with single space and also remove junk characters from the data. How can I do that?

CREATE TABLE test07013
(
NAME VARCHAR2(50)
);
INSERT INTO VALUES ('WARREN,'); -- REMOVE ","
INSERT INTO VALUES ('CLARK H'); -- REPLACE "DOUBLE SPACE" WITH "SINGLE SPACE"
INSERT INTO VALUES ('BRYAN A.'); -- REMOVE "."
INSERT INTO VALUES ('CARTER JR. ROBERT'); -- REMOVE "."," AND REPLACE "DOUBLE SPACE" WITH "SINGLE SPACE"

View 8 Replies View Related

PL/SQL :: How To Replace 2 Single Quotes To Single Quote

Nov 21, 2012

I have an script.sql that receives as a parameter an string.

example:

@C:/myscript.sql "o'connor"

user_account_value varchar2(120) := '&1';

EXECUTE IMMEDIATE "Select * from Table where column = :1 "  USING user_account_value I am not sure how to deal with string that contains single quotes.

If the parameter were passed as : "o''connor" this will work
If the parameter is pass as: "o'connor" this will not work.

so my question is what options do I have to deal with dynamic queries and single quotes.

I tried replacing replace(myParameter,'''',''''''); but not working well.

View 11 Replies View Related

SQL & PL/SQL :: Show Last 4 Digits

Mar 4, 2010

I have a requirement where I have a value stored in varchar2(12), and no matter what the size of data, I should mask all the characters except the last 4

eg: - 23115645

after masking should be - xxxx5645,

create table test1(x varchar2(12))
insert into test1 values('34567745')
/
insert into test1 values('438765311')
/
insert into test1 values('1112345')
/
commit

[Code].....

y should store value of x in such a way that no matter what the size of x is (7 characters or 9), we should see only the last 4, but the remaining should be masked with xxxx

I tried the above update, but using substr, i am able to get this if x has 9 characters

not sure how to achieve this if x has 7, or 4 characters

View 22 Replies View Related

SQL & PL/SQL :: Row Value Show In Column Wise

Mar 1, 2012

I have a table which have three column.

1) empid
2) date
3) status

I want to show the value empid intime outime.

select in1.empid,in1.atttime,out.atttime from (select empid ,atttime from attend
where status=1 and to_char(atttime,'mmyyyy')='022012' order by empid,atttime desc) in1,
(select empid,atttime from attend where status =0 and to_char(atttime,'mmyyyy')='022012'
order by empid,atttime desc) out
where in1.empid=out.empid and in1.empid='02256'
order by in1.atttime,out.atttime

But this query do .one value relation with all column.means first february in time with all out time.

View 1 Replies View Related

Forms :: Reports Does Not Show Any Value

Feb 17, 2011

i am using oracle 10 forms ! in report i have used form Query "select sum(sale_price) from (table) expense. i attached it to oracle forms but at that time it does nt show any value!

View 3 Replies View Related

SQL & PL/SQL :: How To Show Nanoseconds Of CURRENT_TIMESTAMP

Jan 20, 2011

I am using 10g database on Microsoft Windows family OS

when i run following query

sql> SELECT CURRENT_TIMESTAMP FROM DUAL;

then i get result

20-01-2011 11:52:17.921000 AM +05:00

but i want to get result as

20-01-2011 11:52:17.921256 AM +05:00

is there any way to get up mentioned result.

View 1 Replies View Related

SQL & PL/SQL :: Want To Show Data Quarterly

Apr 8, 2013

i want to show data quarterly.My quarter structure is 3 mOnths.

q1 - apr-2013 to jun-2013
q2 - jul-2013 to sep-2013
q3 - oct-2013 to dec-2013
q4 - jan-2014 to apr-2014

I input parameter is from date and to date..

Suppose user enter from date - '01-apr-2012' and to date - '01-aug-2012',
only q1 shows..

and user enter from date - '01-apr-2012' and to date - '30-sep-2012',
only q1,q2 shows..

how i do that..My data is like this

create table t1( t1_month VARCHAR2(10),
t1_val1 number(10),
t1_val2 NUmber(10)
);
INSERT INTO t1('APR-13',100,200);
INSERT INTO t1('MAY-13',100,200);
INSERT INTO t1('JUN-13',100,200);
INSERT INTO t1('JUL-13',100,200);
INSERT INTO t1('AUG-13',100,200);
[code]...

View 2 Replies View Related

SQL & PL/SQL :: Show Result Random

Mar 24, 2010

I run follwing query.

select * from crp_00_08

it shows result like

BAS_CODBAS_DES

1MAIN GATE (FRONT)
2NEAR MILL # 3, 3-1
3NEAR MILL # 3, 3-2
4NEAR MILL # 3, 3-3

[Code]...

i want that when i run above query every time bas_cod column should start with difference value. now it is starting from 1, i need when i run next time it should start with another number except 1,

i mean whenever i run above query,order of bas_cod must be change from last.

how can i do it.

View 12 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved