SQL & PL/SQL :: Removing Leading Single Quote In Excel File?

Feb 20, 2013

This package is generating excel file which contains cursor result.In excel data is populated like below.Column name is Zip_code .My concern is how to remove that single quote from excel file.

eg:

Zip_
'01234
'12567
'23432
'00234

create or replace
PACKAGE BODY PKG_MONTH_END_AUTOMATION AS
PROCEDURE PROC_ZIP_CODE_MONTHEND (directoryOrPath IN VARCHAR2 default 'LOC_PHASE1_WHOUSE_SALES_ADMIN')

[code]...

-- main body

BEGIN
-- Generating Zip Files
SELECT last_day(add_months(sysdate,-1))
INTO v_last_date

[code]...

View 6 Replies


ADVERTISEMENT

SQL & PL/SQL :: Single Excel File For Emp Table Department Wise In Different Sheets Of Excel

Mar 30, 2012

I need to generate a single excel file which each department details in seperate sheets of the excel file, each sheet should ne named with department no (ex :Dept_10, Dept_20,Dept_30) and the main excel should be named as Emp_details.

Header row and total row should be in bold.I have created 3 individual excels thru toad and moved them to single excel and renamed the sheets.

Can we programatically do this thru SQL or PL/SQL, does Oracle provide any build packages for excel.As excel files cannot be uploaded,I am unable to upload the excel file I generated manually.

select to_char(empno) empno,ename,job,mgr,hiredate,
nvl(sal,0) sal,nvl(comm,0) comm,nvl(sal,0) + nvl(comm,0) "Total Income" ,deptno
from emp
where deptno = 10
union all
select 'Total',null,null,null,null,sum(nvl(sal,0)),sum(nvl(comm,0)),sum(nvl(sal,0))+sum(nvl(comm,0)),null
from emp
where deptno = 10;

View 1 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

Client Tools :: Leading Zeroes Are Getting Wiped Off When Results Are Copied Into Excel

Apr 13, 2012

We wrote a query to spool the results in TAB delimited flat file, Results are ok but when copied into excel the leading zeroes are getting wiped off.

Example:

Result: 0000123 and when copied into excel the value is just 123. I need to retain the value as it is 0000123.

Can we control it in the query itself rather than correcting the excel.

View 4 Replies View Related

SQL & PL/SQL :: Array Value In Single Quote?

Jan 9, 2013

create table test_g(x date);
insert into test_g values (to_date('01-NOV-2001','DD-MON-YYYY'));
insert into test_g values (to_date('02-NOV-2011','DD-MON-YYYY'));
insert into test_g values (to_date('03-DEC-2012','DD-MON-YYYY'));
insert into test_g values (to_date('12-DEC-2012','DD-MON-YYYY'));
insert into test_g values (to_date('31-DEC-2012','DD-MON-YYYY'));

[code].....

I wrote below procedure

create or replace procedure p_testq(p_in_date in date) is

v_comp date;
v_strg varchar2(200);
i number:=1;
type t_trc is ref cursor;
trc t_trc;
v_sql varchar2(2000);

-- record to which data goes into

type t_prec is record(x date);
prec t_prec;

-- plsql table to store data

type t_frec is table of t_prec index by binary_integer;
frec t_frec;

-- flow of data, is from v_sql --> plsql record --> plsql table

begin
dbms_output.put_line(' month of paramter '|| P_IN_DATE ||' is '||to_char(P_IN_DATE,'MON'));
select min(x)
into v_comp
from test_g
where x <= P_IN_DATE

[code].....

how do I store v_strg values so that the dates are included in single quotes

begin
p_testq('12-DEC-2012');
end;
v_strg: 06-Nov-2012,09-Nov-2012

I want values to be '06-Nov-2012',''09-Nov-2012'

View 3 Replies View Related

SQL & PL/SQL :: How To Select Data When It Has Single Quote In Value

Sep 4, 2013

The description field in the item table has the single quote used as the symbol for feet. I have the same issue pulling from a last name field in other tables. (Like O'Connor)

select descrip into v_result
from c_ship_hist
where shipment_dtl_id = :SDID;
exception when others then null;

The error I get is "Missing right quote". How do I code around this issue without having to change the data?

View 8 Replies View Related

SQL & PL/SQL :: Escape Character For Single Quote?

May 6, 2011

I have a simple update statement. Sometimes the data in this statement has single quotes in it (like shown below).

Update table1 set account = 'CD'S NOT MINE' WHERE NUMBER = '0027201'

When I run this SQL, I get SQL Error: ORA-01756: quoted string not properly terminated
01756. 00000 - "quoted string not properly terminated"

Is there an escape charecter that I can use?

View 9 Replies View Related

SQL & PL/SQL :: Single Quote(') In Query Not Working?

Jan 5, 2013

I have table say Messages. In which there is a column msg_text varchar2(900).My requirement is to fetch the very last character of the msg_text for a single row identified by its msg_code(primary key).

The problem is, whenever msg_text contain second last character as single quote( ' ), it doesn't give me the last character i.e. after the single quote.For example if msg_text is "Congratulations, you opted for 'A'." and if its message_code is 10 then query

SQL> SELECT SUBSTR(msg_text,LENGTH(msg_text),LENGTH(msg_text)) AS LAST_CHAR
FROM messages
WHERE msg_code = 10;

returns nothing.

Whereas if msg_text is "Are you sure to continue?" and if its message_code is 20 then query

SQL> SELECT SUBSTR(msg_text,LENGTH(msg_text),LENGTH(msg_text)) AS LAST_CHAR
FROM messages
WHERE msg_code = 20;

returns character '?'.

View 4 Replies View Related

SQL & PL/SQL :: How To Insert Single Quote In Insert Statement

Feb 24, 2012

INSERT INTO LKP_ASSET_LOCATION (LOCATION) VALUES ('AMERICA'S CUP VILLAGE')

View 2 Replies View Related

QUOTE V$DATABASE Displays Information About Database From Control File

Feb 8, 2011

The documentation for v$database says: QUOTE V$DATABASE displays information about the database from the control file. Is it safe to assume that there will only ever be one row queried from this view?

View 2 Replies View Related

SQL & PL/SQL :: Remove Only One Leading 0?

Jun 3, 2010

I receive source data with leading zeros. The Rules says: "If there is a leading 0 it has to be removed and data has to be shown starting with character 2".Here is my code I started with:

CREATE TABLE leading_0_test
(
col_1 VARCHAR2(10)
)

insert into leading_0_test values('00123')
select trim(leading'0' from COL_1),trim(leading'0' from substr(COL_1,1,1)),COL_1 from leading_0_test

The first trim removes all leading zeros. Therefore I tried to solve it with the substr, but without success.

View 7 Replies View Related

How To Replace Leading Wildcards

Jan 16, 2011

So many of the queries in our database query by an account but an account is allowed to vary by prefix and so queries are written similar to account like '%suffix'

Our DBA has rejected the use of context indexes and friends to deal with this.

as an aside and I'm probably going to regret going into this much detail but our model is

A->>B->>C

typically the queries want to fetch C's for a customer defined by A.account

A, B, C are all partitioned with partition key created_date

however, only C is typically queried with created_date as a qualifier. A and B are related by joins from A->>B and B->>C

when queries are written to use '%' leading wildcards often it results in a full table scan across multiple partitions. on any given day all we care about are the most recent C's for the customer where customer is defined by A.account.

I recently had an idea whereby fields such as A.Account could also be kept(denormalized) in the C table

the idea is if the queries were written to use C.account like '%bla' instead of A.account like '%bla' then because C is always qualified with the partition key ie. C.created_date that would at worst result in a full partition scan only. this is considerably less expensive than doing a full table scan of A. The IO cost of doing that is huge.

populating the C.account is a simple before insert or update trigger. when you insert a C you have a foreign key to a B and B has a foreign key to A. A and B are always created before any C is seen for any given C. When a C is seen A and B already exist in the database.

View 3 Replies View Related

SQL & PL/SQL :: Showing Leading Zeroes In XML?

Sep 15, 2011

I am generating an XML file from plsql using utl_file.There is a problem in number field.The value in the table is 0.18 and it is showing up in xml as .18. The leading zero is not showing up.

COLUMN_NAME is number (15);

<TAG>' || A.COLUMN_NAME || '</TAG>

I have tried using to_char(), but it is still showing up as .18 in XML. I want it as 0.18 in XML as well.

View 1 Replies View Related

Performance Tuning :: Index Leading Columns?

Dec 14, 2010

I have been reading Oracle documentaion about access paths, got strucked at the concept 'Leading columns in index'. what is meant by 'Leading columns of an index', how to find/judge them that they are leading columns.

The url where I am reading is[URL]...

View 4 Replies View Related

Forms :: D2k 6i And Excel File?

Jun 23, 2010

I have generate a excel file through oracle developer 2000 6iwith password protect using OLE2 but autofilter,sort and format column options are not working.

PROCEDURE UnProtectCell(r NUMBER,c NUMBER) IS
BEGIN
args:= ole2.create_arglist;
ole2.add_arg(args, NumToRange(r, c));
XLRange:= ole2.get_obj_property worksheet, 'Range', args); ole2.destroy_arglist(args);

[code]...

View 6 Replies View Related

SQL & PL/SQL :: Reading From A Excel File

Dec 1, 2011

I am looking for a code/script to read values from excel file and perform PLSQL script.

Now i have the PLSQL script to generate report which takes two value which i have to change all the time to generate new report .All i wanna do create a script to read from a excel file and perform the other script.

I have been searching from a long time and only found UTL_file Package which use CREATE OR REPLACE FUNCTION and create some virtual table.

The problem is i don't have create authorization in database so i m not able to use UTL_File command . Is there any simple way to read value from excel file?

View 16 Replies View Related

SQL & PL/SQL :: Excel File Can't Open

Aug 17, 2010

im sending email with attachment of report output in xml format. file was attached but cant opened.

it show me error at the time of opening that

XML ERROR in Unknown
REASON: Illegal Tag
FILE: C:Documents and SettingsTxisDesktopAR_AGING_DETAILS_1186958_1(3).XML
VALUE: ?B/to{??C

i face this problem when i send mail on yahoo and from outlook. but it opened in gmail, from incredimail

View 1 Replies View Related

SQL & PL/SQL :: Import Excel File To Table

Jan 10, 2013

I have two columns in excel which i need to import in oracle table , but the problem is one column is of type date , i want the same date format to be maintained in table too.

View 8 Replies View Related

SQL & PL/SQL :: Convert Excel File Into Text?

Aug 2, 2010

i want to convert an excel file into text and then into oracle table.

View 6 Replies View Related

SQL & PL/SQL :: Procedure To Convert Excel File To XML?

Mar 21, 2012

I need a PL/SQL code to convert an excel file to xml file.

View 3 Replies View Related

SQL & PL/SQL :: Image In XML To Generate Excel File

Jul 8, 2010

how to attach an IMAGE in XML and that will be used in PL SQL procedure to generate the Excel file with the IMAGE. I cannot able to save the xml as excel with the image

View 3 Replies View Related

SQL & PL/SQL :: Export BLOB File In Excel?

Dec 5, 2012

I want to export the data from oracle with BLOB column in excel file.

BLOB file contains the Image (jpg)

View 5 Replies View Related

Forms :: How To Generate Excel File

Jun 12, 2012

I want to gerate the excel(Office 2010)file using oracle forms 6i. How we can achieve this with forms 6i?

View 4 Replies View Related

SQL & PL/SQL :: Create Report In Excel File?

Dec 22, 2010

I want to create a excel report by joining 2 tables.

Is there any stabdard package which i can use for creating this report.

View 3 Replies View Related

Forms :: How To Export Data In 10g To Excel File

Mar 15, 2011

I need the code to export the data from the form to the excel directly.

View 1 Replies View Related

Forms :: Uploading An Excel File Using Webutil In AIX

Apr 18, 2013

When i am uploading data in an excel file to my Forms(Windows) the screen works fine but when i am uploading the same excel file to my forms in AIX(Where the application is running) the data is uploaded with decimal points.

The field is a char type and no format mask is set.

E.g. :
Actual data: In Form(Windows) In Form (AIX)
4080026 4080026 4080026.0

View 5 Replies View Related

Forms :: Data Export To Excel File

Jul 14, 2009

i want to add one button in the form like "save as" and save the displayed data into excel file.

View 20 Replies View Related

SQL & PL/SQL :: Read Excel File Using UTL_FILE Package

Jul 23, 2010

Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
PL/SQL Release 11.1.0.6.0 - Production
"CORE 11.1.0.6.0 Production"

Is there a way to read Excel file using UTL_FILE package ?

Like our usual method:
l_utlfile := utl_file.fopen(p_dir, p_filename, 'R',2000);
p_filename is event.xls

Or do we need to convert that file to .csv or .txt ?

View 5 Replies View Related

Forms :: Uploading Excel File Using Webutil In AIX

May 28, 2013

When i am uploading data in an excel file to my Forms(Windows) the screen works fine . But when i am uploading the same excel file to my forms in AIX(Where the application is running) the data is wrongly uploaded . The field is a number type and no format mask is set.

E.g. :
Actual data:---------- In Form(Windows)------In Form (AIX)
3101513480750030000 3101513480750030000 3101513480750029800

I am using below code to copy the value

cell_value :=Client_OLE2.get_num_property(cell, 'Value');
COPY(cell_value,'data.field'||k);

View 3 Replies View Related

Forms :: OLE2 Updating Excel File From 6i

Dec 12, 2011

I am using OLE2 to update an excel spreadsheet from Oracle Forms 6i. If the excel spreadsheet is already open, the code runs through fine, and even asks if you want to replace the file when running the lines: OLE2.INVOKE(worksheet, 'Save');

OLE2.INVOKE(workbook, 'Save');

However, the file never gets updated. There is no error that appears. I would like to have the program check if the file is open before running the program;

View 1 Replies View Related







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