SQL & PL/SQL :: How To Append Data Into Macro-enabled Excel File
Aug 18, 2010
My requirement is to export Oracle table's data into an already existing excel file with Macros (.xlsm) using a procedure. I am able to write/append the data into the simple .xls file. But I am searching whether any way of appending into .xlsm file. "how can we append the data into a Macro-enabled excel file?".
we are using ERP System based on Oracle DB. I have an oracle client 10.2.0 installed on my machine (Win 7/64-Bit) and trying to create Excel(2010) VBA-Macro to get datas out of the Oracle DB using a SQL query:
On my old machine (Win XP/Excel 2007) following worked fine:
All the datas in the variables coming from cells or userforms - I am 100% sure all this is correct, as as said, it works on any Win XP Machine with Excel 2007
But trying same with Win 7/64-Bit/Excel 2010 gives me following error: MS ODBC Driver for Oracle: ora-01019: unable to allocate memory in the user side.
I installed Oracle 11gR2 database for windows 7. I believe it's 32 bit. I keep getting an error when I run my macro excel: Error while trying to retrieve text for error ORA-01019.
I am just looking to my control file that I have. I have managed to successfully get my control file to load data into the required tables but just for my learning I was trying to amend the when clause with an and condition but keep getting an error.
My code: OPTIONS (DIRECT=TRUE, ERRORS=0, SKIP=1) load data infile 'A:/My Files/Feeds/20130211/data_summary_1_20131214.txt' "STR ' '"
APPEND into table I_DATA_1 WHEN (RID <> 'RID') fields terminated by "~|~" optionally enclosed by '"' TRAILING NULLCOLS ( RID, S_TIMESTAMP timestamp 'DD-MON-RR HH:MI:SS.FF3 PM' )
the above code works perfectly but if i change the following line:
WHEN (RID <> 'RID' AND 'S_TIMESTAMP' IS NOT NULL)than this gives me an error.
Version: 11.2.0.3 Platform : RHEL 5.8 (But I am looking for platform independant solution)
I want to append the timestamp to spooled log file name in SQL*Plus.The spooled log filename should look like
WMS_APP_23-March-2013.logI tried the following 3 methods found in the google. But none of them worked !
I tried this
col sysdt noprint new_value sysdt_var SELECT TO_CHAR(SYSDATE, 'yyyymmdd_hh24miss') sysdt FROM DUAL; spool run_filename_&sysdt_var.Logas suggested in
[URL]
and this
spool filename with timestamp col sysdt noprint new_value sysdt SELECT TO_CHAR(SYSDATE, 'yyyymmdd_hh24miss') sysdt FROM DUAL; spool run_filename_&sysdt..Logas suggested in
[URL]
and this
column tm new_value file_time noprint select to_char(sysdate, 'YYYYMMDD') tm from dual ; prompt &file_time spool logfile_id&file_time..logas suggested in
Creating a spool file with date/time appended to file name
I have a Excel File which contains some columns and rows, i need to load that excel into a form and import that form data to Database Table, using DDE Method.
In simple i say; Just to read the excel and load into a form, which can be imported into a table later.
I want to export the oracle data into an excel sheet. I have written the code by using UTL_FILE package. but i am getting the output as shown in the screen shot(without formatting the column size as the width of the data it has). But I want the output column width to be set according to the size of the data automatically.
I have countries, sites, states tables (total 3) in database (i have user id and password to connect to this database).
every week i need to extract data from these tables into excel files and i need to save those in shared drive for team use.
Currently i am connecting to database every time running sql query and manually exporting that latest data to excel and saving that as excel files in (G: eamcommon) folder with specific name.
output format should be :
excel (.xls) file names should - countries.xls,sites.xls,states.xls server name : ap21 output location : G: eamcommon ( G is shared drive).
i heard that we could create batch file to do this task and also we could use oracle procedure to do this task. but not sure which one is the best option.
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;
I'm currently having a problem with regards to Exporting data to another server. This is the Scenario:Source Server is Production Server with all of its Tables in the Schema are Version-Enabled.
Destination Server is a Test Server.I exported data from Production Server using EXP command. Then in my Test Server I imported my data using IMP command (I already created tablespace and user for the Schema).Import is successful in my Test server but when I execute my queries, There are no rows returned.
I checked my _LT tables and it contains my data. but when I query from the View created when version was enabled, no result is returned.Am I missing something when I exported and imported my Schema? Should I have included the WMSYS schema when I created the .dump file?
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);
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?
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.
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