How to enclosed the column with in double quotes while spooling to csv fie
Dear Members,
I have to spool a sql to a CSV file. I have two columns to spool one is vendor_id and another is vendor_name. But the 2nd column vendor_name has commas in it so if i see the o/p it looks like this:
Suppose vendor_id = 12790 vendor_name = T T I, INCORPORATED
when i see the csv file it looks
12790,T T I, INCORPORATED
I want each column be enclosed in double quotes like this
"12790","T T I, INCORPORATED"
How can i do this in sql*plus while spooling to a csv file.
Thanks
sandeep
this?
SQL> select '"'||'Hi'||'"'||',"'||'how'||'"' from dual;
'"'||'HI'|
"Hi","how"
Similar Messages
-
I use MS Excel 2007.
I want to keep the column fixed whenever I refresh data in pivot tables.
I tried even coding it with a macro:
Columns("B:F").Select
Columns("B:F").EntireColumn.AutoFit
And, in another time I tried columnwidth value to a fixed number; both doesnt work.
Please suggest a solution
Thanks in advance
Rafeek KBMHi Rafeek,
One solution is to set the column width after manually or programmatically refresh the PivotTable, for example:
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
Dim ws As Worksheet
Set ws = Application.ActiveWorkbook.ActiveSheet
ws.Columns("A").ColumnWidth = 10
End Sub
Another option is to set the column width, then protect the columns from been updated by the user, before refreshing the PivotTable, unprotect the worksheet. For example:
Public Sub LockColumnA()
Dim ws As Worksheet
Set ws = Application.ActiveWorkbook.ActiveSheet
ws.Columns("A").ColumnWidth = 10
ws.Columns("A").Locked = True
ws.Protect "123"
End Sub
Public Sub UnprotectWorksheet()
Dim ws As Worksheet
Set ws = Application.ActiveWorkbook.ActiveSheet
ws.Unprotect ("123")
End Sub
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How to select the column with respect to language in sql server
USE Master
SELECT * FROM SysMessages
GO
when i execute the above query, in description column am getting English and Chinese , here if i want to select only English .
how can i select only English language by using WHERE condition.
And why am getting data in Description column in Chinese also any reason behind it.
If there is any reason please suggest me.Bro , here am not getting what is Unicode and all
Specially ,
Why does we need N' string ' while inserting and Why we need to place N and String in Unicode while inserting data and what does it mean.
Insert into T1 Values
(N'找不到由給定的 @article 或 @artid ''%1!'' 所參考的物件。'),
(N'Unclosed quotation mark after the character string .') -
How to replace one double quotes with two double quotes in XSLT
How can I replace one double quote to a two double quote in a string in XSLT
I am passing the parameter string to XSLT template contains the value as
<xsl:variable name="Description">Hi! "How are you</xsl:variable>
<xsl:variable name="VQuotes">""</xsl:variable>
I nead the output as
Hi! ""How are you.
Tried with Translate function, but it did not work out
<xsl:element name="DESCRIPTION_SHORT">
<xsl:value-of select="translate($Description,'"', VQuotes)" />
</xsl:element>But it is giving the same result as Hi! "How are you
When I tried with
<xsl:element name="DESCRIPTION_SHORT">
<xsl:value-of select="translate($Description,'"', 'BB')" />
</xsl:element>
It gave the result as
Hi! BHow are you.
It is replacing only one character with one. how to make it for two characters.
Am I doing anything wrong in syntax?
Please help.
Regards, Vignesh SHi Vignesh,
Try this.
Its a two step process:
Step1: Add the following template would be "called" to do the replacement as your want:
<xsl:template name="string-replace-all">
<xsl:param name="text" />
<xsl:param name="replace" />
<xsl:param name="by" />
<xsl:choose>
<xsl:when test="contains($text, $replace)">
<xsl:value-of select="substring-before($text,$replace)" />
<xsl:value-of select="$by" />
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text"
select="substring-after($text,$replace)" />
<xsl:with-param name="replace" select="$replace" />
<xsl:with-param name="by" select="$by" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Step2: Call the above templeate in the place where you want to call, like this:
<!--Define the variables-->
<xsl:variable name="Description">Hi! "How are you</xsl:variable>
<xsl:variable name="sQuotes">"</xsl:variable>
<xsl:variable name="VQuotes">""</xsl:variable>
<!--Following call the template which you have defined in step1-->
<xsl:element name="DESCRIPTION_SHORT">
<xsl:variable name="myVar">
<xsl:call-template name="string-replace-all">
<xsl:with-param name="text" select="$Description" />
<xsl:with-param name="replace" select="$sQuotes" />
<xsl:with-param name="by" select="$VQuotes" />
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$myVar" />
</xsl:element>
I have tested this and works. And outputs as the following with two-double quote as you want.
<DESCRIPTION_SHORT>Hi!
""How are you</DESCRIPTION_SHORT>
If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply. -
00904 error when sorting columns that require double quotes
We have used an ETL tool to import an XML file into Oracle 10g. The column names are mixed case and unfortunately have to remain mixed case because we have a "column" and a "Column" name with different info in them. So when we migrate it in, the field names have be enclosed in double quotes in all SQL operations. The problem in SQL Developer 1.5.1 (Win XP SP2, Oracle 10G) though is that if I try to sort on a column by double clicking the column header, we get an ORA-00904 error COLUMN does not exist. So it looks like it is trying to do an ORDER BY without putting the column name in double quotes. Has anybody else had issues with this and is there a fix for it?
Message was edited by:
coachyIt's a bug.
Logged Bug 7344539 - 00904 error when sorting columns that require double quotes
Workaround: Use the sort button on DataTab's toolbar.
-Raghu -
How to find the column name and table name with a value
Hi All
How to find the column name and table name with "Value".
For Example i have value named "Srikkanth" This value will be stored in one table and in one column i we dont know the table how to find the table name and column name
Any help is highly appricatable
Thanks & Regards
Srikkanth.M2 solutions by Michaels (the latter is 11g upwards only)...
michaels> var val varchar2(5)
michaels> exec :val := 'as'
PL/SQL procedure successfully completed.
michaels> select distinct substr (:val, 1, 11) "Searchword",
substr (table_name, 1, 14) "Table",
substr (t.column_value.getstringval (), 1, 50) "Column/Value"
from cols,
table
(xmlsequence
(dbms_xmlgen.getxmltype ('select ' || column_name
|| ' from ' || table_name
|| ' where upper('
|| column_name
|| ') like upper(''%' || :val
|| '%'')'
).extract ('ROWSET/ROW/*')
) t
-- where table_name in ('EMPLOYEES', 'JOB_HISTORY', 'DEPARTMENTS')
order by "Table"or
SQL> select table_name,
column_name,
:search_string search_string,
result
from cols,
xmltable(('ora:view("'||table_name||'")/ROW/'||column_name||'[ora:contains(text(),"%'|| :search_string || '%") > 0]')
columns result varchar2(10) path '.'
where table_name in ('EMP', 'DEPT')
TABLE_NAME COLUMN_NAME SEARCH_STRING RESULT
DEPT DNAME ES RESEARCH
DEPT DNAME ES SALES
EMP ENAME ES JONES
EMP ENAME ES JAMES
EMP JOB ES SALESMAN
EMP JOB ES SALESMAN
EMP JOB ES SALESMAN
EMP JOB ES PRESIDENT
EMP JOB ES SALESMAN
9 rows selected. -
How can i register column with in the query
hi all
how can i register column with in the query?Thanks.
In my business one, the column width was registed.
But I don't know how can I do it.
So I try to save the query again after change column width.
Then the query was opend with changed column width.
Is it right function?
Is there any way to register the column width?
It's very troublesome to change column width every time.
seiichi -
Reg:How to delete the column in table control also from database table.
Hi Experts,
Once again thank u all for giving the responses.
one more doubt is how to delete the columns of table control and also the record shold delete from ztable.
With Regards,
Saroja.P.Hi,
If you want to delete the rows in the table control and simultaneously delete it from the database table, then you can implement a 'DELETE' functionality specific to your table control. Have a MARK field (you will find that in the screen attributes of the table control -> give a name for the MARK field, you will find an additional MARK column at the beginning of your table control). You can check whatever rows you want to delete from the table control, call the delete module.
"This portion of code inside the LOOP...ENDLOOP.
IF sy-ucomm eq 'F_DELETE'.
gt_itab2-check = mark. " Store the MARK field status into your internal table's correspoding field 'check'
MODIFY gt_itab INDEX tabcontrol-current_line.
ENDIF.
iF sy-ucomm eq 'DELETE1'.
DELETE gt_itab WHERE check eq 'X'. "Your internal table does not have rows that you want to delete
ENDIF.
Now you can modify your database table using the MODIFY statement.
MODIFY ZDB FROM TABLE gt_itab. -
How to use the column names generated from Dynamic SQL
Hi,
I have a problem with Dynamic SQL.
I have written an SQL which will dynamically generate the Select statement with from and where clause in it.
But that select statement when executed will get me hundreds of rows and i want to insert each row separately into one more table.
For that i have used a ref cursor to open and insert the table.
In the select list the column names will also be as follows: COLUMN1, COLUMN2, COLUMN3,....COLUMNn
Please find below the sample code:
TYPE ref_csr IS REF CURSOR;
insert_csr ref_csr;
v_select VARCHAR2 (4000) := NULL;
v_table VARCHAR2 (4000) := NULL;
v_where VARCHAR2 (4000) := NULL;
v_ins_tab VARCHAR2 (4000) := NULL;
v_insert VARCHAR2 (4000) := NULL;
v_ins_query VARCHAR2 (4000) := NULL;
OPEN insert_csr FOR CASE
WHEN v_where IS NOT NULL
THEN 'SELECT '
|| v_select
|| ' FROM '
|| v_table
|| v_where
|| ';'
ELSE 'SELECT ' || v_select || ' FROM ' || v_table || ';'
END;
LOOP
v_ins_query :=
'INSERT INTO '
|| v_ins_tab
|| '('
|| v_insert
|| ') VALUES ('
|| How to fetch the column names here
|| ');';
EXECUTE IMMEDIATE v_ins_query;
END LOOP;
Please help me out with the above problem.
Edited by: kumar0828 on Feb 7, 2013 10:40 PM
Edited by: kumar0828 on Feb 7, 2013 10:42 PM>
I Built the statement as required but i need the column list because the first column value of each row should be inserted into one more table.
So i was asking how to fetch the column list in a ref cursor so that value can be inserted in one more table.
>
Then add a RETURNING INTO clause to the query to have Oracle return the first column values into a collection.
See the PL/SQL Language doc
http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/returninginto_clause.htm#sthref2307 -
How to extract the column width in ALv report if its executed in background
I am executing an ALV report in background , in front end i am getting data properly, in back end for some columns some of the digits are missing.For example if PO no is of 10 digits it will display only 8 becos column size is like that , how to extract coulmns in back ground.
I have executed in background and checked the spool and for some of the columns width is not sufficient to display comeplete data so please suggest how to extract the columns sizes if executed inj background for an ALVHi Deepthi,
you can try with the above mentioned suggestions ,if its worked its fine ,
If not use Docking container instead of custom container, For ALV in back ground jobs, its suggest to use docking container instead of custom container , below you can find the declaration for docking container and code to use docking and custom container in your program for fore and back ground.
or you can use docking container alone for both operations.
Data : G_DOCK1 TYPE REF TO CL_GUI_DOCKING_CONTAINER,
IF CCON IS INITIAL. (ccon is container name )
*Check whether the program is run in batch or foreground
IF CL_GUI_ALV_GRID=>OFFLINE( ) IS INITIAL.
*Run in foreground
CREATE OBJECT CCON
EXPORTING
CONTAINER_NAME = 'CON1'.
CREATE OBJECT GRID1
EXPORTING
I_PARENT = parent_1.
ELSE.
*Run in background
CREATE OBJECT GRID1
EXPORTING
I_PARENT = G_DOCK1.
ENDIF.
ENDIF.
B&R,
Saravana.S -
How to use the Columns Hidden | space in the bottom of af:panelCollection?
Hi,experts,
In jdev 11.1.2.3,
I can see a row of Columns Hidden | Columns Frozen in the bottom of component af:panelCollection - pc1 which have an af:table - t1 component inside in designer view,
and can see there is a blank row space only with "|" inside when the page is running.
Now I want to use this blank row space such as to display row numbers for the table, so I set the property for the panelColletion as following source code:
==========================
<af:panelCollection id="pc1" inlineStyle="width:1250px; height:500px;">
<f:facet name="menus"/>
<f:facet name="toolbar"/>
<f:facet name="statusbar">
<af:group id="g4"/>
</f:facet>
<af:table value="#{bindings.TView1.collectionModel}" var="row"
rows="#{bindings.TView1.rangeSize}"
emptyText="#{bindings.TView1.viewable ? 'No data to display.' : 'Access Denied.'}"
fetchSize="#{bindings.TView1.rangeSize}" rowBandingInterval="1"
filterModel="#{bindings.ImplicitViewCriteriaQuery.queryDescriptor}"
queryListener="#{bindings.ImplicitViewCriteriaQuery.processQuery}" filterVisible="false"
varStatus="vs"
selectedRowKeys="#{bindings.TView1.collectionModel.selectedRow}"
selectionListener="#{bindings.TView1.collectionModel.makeCurrent}"
rowSelection="single" id="t1" inlineStyle="font-size:xx-large; font-weight:bolder;">
<af:column sortProperty="#{bindings.TView1.hints.GoodsStatus3.name}" filterable="true"
sortable="true"
headerText="#{bindings.TView1.hints.GoodsStatus3.label}"
id="c42">
<af:outputText value="#{row.GoodsStatus3}" id="ot33"/>
</af:column>
<f:facet name="footer">
<af:group id="g3">
*<af:outputText value="RowsNumber:" id="ot44"/>*
*<af:outputText value="#{bindings.TView1Iterator.estimatedRowCount}"*
id="ot43" partialTriggers="::pc1:t1"/>
</af:group>
</f:facet><f:facet name="detailStamp"/>
</af:table>
</af:panelCollection>
=====================
but when run the page there is no display for the row number, instead on the bottom of the table, there is only a blank row with "|" inside.
How to use the Columns Hidden | Columns Frozen space in the bottom of component af:panelCollection ?
Thanks!Hi, Arun
It works.
As in my use case, can draw an af:toolbar component into statusbar of Panel Collection facets in Structure view.
There is still a small issue:
cannot see the Columns Hidden|Columns Frozen component in the Structure view,
and if drop more than one af:toolbar into statusbar, the sencond one will fall/wrap into second row, even though there is enough space on the first row (to occupy a second row in statusbar will be a waste of space), and cannot see how to adjust.
Thank you very much!
bao -
Hi,
I am using OCCI to interact with DB through code, which means I am writing a vc++ file to interact with Data Base and execute the Stored Procedure which I am calling from the C++ Code. And also displaying the output of the Stored Procedures to the Front End. I am succeeded in this, but now I should be able to display the Column names of the output to Front End. Can any one help me on this.
Example:
Sno | Sname
------- |-------------
1 ABC
2 DEF
I am getting (1,ABC) and (2,DEF) as the output of the Stored Procedure but I need the Column names also to display. How to get them.
Thanks in Advance..:)Look at Re: exporting csv via pl/sql - select statement?
It has an example how to extract the column name from a cursor. You have to check, whether you can use DBMS_SQL.DESCRIBE_COLUMNS
Your procedure might need another out parameter, that returns the column names , e.g. as comma separated list or as varray. -
Dear SharePoint Developers,
Please help.
I need to know How to set the column order of a sealed column in a custom Content Type for the new item form NewDocSet.aspx?
I think this is a "sealed column", whatever that is, which is shown in SPD 2013 as a column of content type "document, folder, MyCustomContentType".
I know when I set the column order in my custom Content Type settings page, it is correct.
But, when I load the NewDocSet.aspx page, the column order that I set in the settings page is NOT used for this "sealed column" which is bad.
Can you help?
Please advise.
Thanks.
Mark Kamoski
-- Mark KamoskiHi,
According to your post, my understanding is that you want to set the column order of a sealed column in a custom Content Type for the new item form NewDocSet.aspx.
Per my knowledge, if you have Content Type management enabled for the list or library (if you see a list of content type with the option to add more), the display order of columns is set for each content type.
Drill down into one of them and you'll see the option under the list of columns for that content type.
To apply the column order in the NewDocSet.aspx page, you need to:
Select Site Settings, under Site Collection Administration, click Content type publishing. In the Refresh All Published
Content Types section, choose Refresh all published content types on next
update.
Run two timer jobs(Content Type Hub, Content Type Subscriber) in central admin(Central Administration--> Monitoring--> Review timer jobs).
More information:
http://sharepoint.stackexchange.com/questions/95028/content-types-not-refreshing-on-sp-online
Best Regards,
Linda Li
Linda Li
TechNet Community Support -
How to make text columns with adobe muse
Hi,How to make text columns with adobe muse (like InDesign)?
Multiple columns can be acheived with CSS - http://www.w3schools.com/css/css3_multiple_columns.asp
div
-moz-column-count:3; /* Firefox */
-webkit-column-count:3; /* Safari and Chrome */
column-count:3;
I'm surprised that Muse does not support text columns yet, but perhaps the custom CSS can be added in style tags on page properties. Haven't tried it, but don't see why it wouldn't work. -
How to hide the columns at the end user level thru personalization
Hi all
how I can hide the columns that are displayed on the portal. Any personalize option for the end user? Any righ click or some thing?
I am looking at hiding columns not while developing the iViews / Pages, But in the browsers as the end user.
i can hide the columns what ever i want while creating the iViews for MDM data. but we cant provide the content administrator role to the end user for hiding the columns what ever they want. they want to hide the columns thru pesonalization option at the end user level.
Can you please let me know whether we can able to hide the columns at the end user level thru personalization ?? is it posible with standard iViews??
Regards
SunilHi Sunil,
I understood your requirement properly and seems valid and I tried this at my end but i didnt get the solution. Field list is not visible in Personalize option. I dont think it is possible with MDM standard iViews.
I was thinking an alternative is if some how we manage to give the permissions to end user only on Result Set iView but if it would be possible it will not be a good design.
Lets wait for some inputs from others.
Regards,
Jitesh Talreja
Maybe you are looking for
-
My iPhone 4, firmware 4.0.2, has issues randomly when sending emails. It doesn't matter if it's from my Gmail account or my Exchange account, either way it sits there with the spinning logo in the status bar, and "sending" on the bottom of the app. I
-
Issues in EPM Add-in after installing MS Updates
Hi, We have acknowledged of BPC EPM add-in problems after some MS Office updates. What we know so far is that this error occurs on BPC 10 NW version and it was delivered an SAP Note (2107965) with resolution/workarounds. On our system we have BPC 10
-
ZFH5.1 Proxy SILENT Install
Hello everyone, I'm trying to get a silent install setup for the proxy clients and I just can't seem to get it to work. I've read through the admin guide, following it to the letter, but it doesn't seem to work silently. It created the setup.iss file
-
I've had a Samsung network extender for over a year and it's been great. About a week ago, my iPhone 5 stopped connecting to it. I've never had problems with this. All the lights on the extender are blue, so it seems it's working fine. Any sugges
-
How to reduce image size on photoshop without losing quality
i have a logo that needs to be shrunk. but as soon as i shrink it the image looks pixelated. if i leave it as-is, the website says the size is too big. please advise. Dale Mundi