SQL Loader Truncate and SQL TRUNCATE difference
Could any one let me know what is difference between truncate used by control file of the SQL Loader and TRUNCATE command used by SQL? Is there any impact or difference of these both over the data files.
Thanks
Mr Jens I think TRUNCATE in SQLLDR control file reuses extents, unlike SQL TRUNCATE command. In my opinion it is best to truncate these to show the normal usage of these tables, not the elevated values.
Could you please further comment?
Similar Messages
-
SQLLDR TRUNCATE and SQL TRUNCATE Difference
Could any one let me know what is difference between truncate used by control file of the SQL Loader and TRUNCATE command used by SQL? Is there any impact or difference of these both over the data files.
ThanksDuplicate posting
SQL Loader Truncate and SQL TRUNCATE difference -
Change the mapping generation code from sql*loader to pl/sql
I want to use a mapping with a flat file operator to generate pl/sql code even if a mapping generate sql*loader code as default.
I tried to change the Language generation property of the mapping but an API8548 error message is shown. The suggested solution by OWB is to change the language generation code in the property inspector of the mapping.
I can't use external table because I have to work with a remote machine.
What i have to do to change the generation code from SQL*Loader to PL/SQL?How about breaking this out into 2 mappings? In the first mapping, map a flat file operator to an table using SQL*Loader code. Then define a second mapping using the table as source and therefore generate PL/SQL. Then use process flow to launch the 2nd map to run after completion of first.
-
How to switch between SQL Server Express and SQL Server Evaluation
I have both SQL Server Express and SQL Server Evaluation installed on my laptop.
I am wondering how to start SQL Server Evaluation; when I click All Programs > SQL Server Management Studio, I always get SQL Server Express (which I installed on my laptop a couple years ago).
I just downloaded SQL Server Evaluation (a couple days ago).
Whenever I try to access SQL Server Evaluation, I always seem to get SQL Server Express.
Sorry if this is a trivial thing; I just can’t seem to get it to work (and I Googled for a solution before posting this).
Thanks everyone!!Ah! It worked!! This is great!! It seems like I can connect to my version of SQL Server Evaluation, named 'EXCEL-PC\EXCEL'.
Somehow, though, I seem to keep getting errors in my BIDS when I try to run an SSIS project. See below:
Ah! It worked!! This is great!! It seems like I can connect to my version of SQL Server Evaluation, named 'EXCEL-PC\EXCEL'.
I am getting an error that VS is unable to load a document:
BIDS has to be installed by one of these editions of SQL Server 2008: Standard, Enterprise, Developer, or Evaluation.
To install BIDS, run SQL Server Setup and select Business Intelligence Development Studio.
#1) I recently downloaded and installed SQL Server Evaluation (specifically for the opportunity to try using BIDS and learn about this technology).
#2) When I run BIDS > SSIS, I get the error I described above.
#3) I have had SQL Server Express installed for a couple years on my laptop
So, my question is this: is it possible that BIDS > SSIS is picking up my SQL Server Express, instead of SQL Server Evaluation?
If so, how can I get BIDS to point to SQL Server Evaluation?
You can see in the image above that I have my BIDS Data Connections pointing to EXCEL-PC\EXCEL, which is the name of my SQL Server Evaluation.
Is this correct? Why doesn’t this work?
I’ve spent some considerable time on this. I’m close to just uninstalling EVERYTHING pertaining to SLQ Server, and just reinstalling SQL Server Evaluation, but this will take some time, and I don’t necessarily want
to get rid of my SQL Server Express. However, if that’s the only way to get this working, then that’s what I’ll do.
I’d greatly appreciate any insight into this!! -
PL/SQL 101 : Cursors and SQL Projection
PL/SQL 101 : Cursors and SQL Projection
This is not a question, it's a forum article, in reponse to the number of questions we get regarding a "dynamic number of columns" or "rows to columns"
There are two integral parts to an SQL Select statement that relate to what data is selected. One is Projection and the other is Selection:-
Selection is the one that we always recognise and use as it forms the WHERE clause of the select statement, and hence selects which rows of data are queried.
The other, SQL Projection is the one that is less understood, and the one that this article will help to explain.
In short, SQL Projection is the collective name for the columns that are Selected and returned from a query.
So what? Big deal eh? Why do we need to know this?
The reason for knowing this is that many people are not aware of when SQL projection comes into play when you issue a select statement. So let's take a basic query...
First create some test data...
create table proj_test as
select 1 as id, 1 as rn, 'Fred' as nm from dual union all
select 1,2,'Bloggs' from dual union all
select 2,1,'Scott' from dual union all
select 2,2,'Smith' from dual union all
select 3,1,'Jim' from dual union all
select 3,2,'Jones' from dual
... and now query that data...
SQL> select * from proj_test;
ID RN NM
1 1 Fred
1 2 Bloggs
2 1 Scott
2 2 Smith
3 1 Jim
3 2 Jones
6 rows selected.
OK, so what is that query actually doing?
To know that we need to consider that all queries are cursors and all cursors are processed in a set manner, roughly speaking...
1. The cursor is opened
2. The query is parsed
3. The query is described to know the projection (what columns are going to be returned, names, datatypes etc.)
4. Bind variables are bound in
5. The query is executed to apply the selection and identify the data to be retrieved
6. A row of data is fetched
7. The data values from the columns within that row are extracted into the known projection
8. Step 6 and 7 are repeated until there is no more data or another condition ceases the fetching
9. The cursor is closed
The purpose of the projection being determined is so that the internal processing of the cursor can allocate memory etc. ready to fetch the data into. We won't get to see that memory allocation happening easily, but we can see the same query being executed in these steps if we do it programatically using the dbms_sql package...
CREATE OR REPLACE PROCEDURE process_cursor (p_query in varchar2) IS
v_sql varchar2(32767) := p_query;
v_cursor number; -- A cursor is a handle (numeric identifier) to the query
col_cnt integer;
v_n_val number; -- numeric type to fetch data into
v_v_val varchar2(20); -- varchar type to fetch data into
v_d_val date; -- date type to fetch data into
rec_tab dbms_sql.desc_tab; -- table structure to hold sql projection info
dummy number;
v_ret number; -- number of rows returned
v_finaltxt varchar2(100);
col_num number;
BEGIN
-- 1. Open the cursor
dbms_output.put_line('1 - Opening Cursor');
v_cursor := dbms_sql.open_cursor;
-- 2. Parse the cursor
dbms_output.put_line('2 - Parsing the query');
dbms_sql.parse(v_cursor, v_sql, dbms_sql.NATIVE);
-- 3. Describe the query
-- Note: The query has been described internally when it was parsed, but we can look at
-- that description...
-- Fetch the description into a structure we can read, returning the count of columns that has been projected
dbms_output.put_line('3 - Describing the query');
dbms_sql.describe_columns(v_cursor, col_cnt, rec_tab);
-- Use that description to define local datatypes into which we want to fetch our values
-- Note: This only defines the types, it doesn't fetch any data and whilst we can also
-- determine the size of the columns we'll just use some fixed sizes for this example
dbms_output.put_line(chr(10)||'3a - SQL Projection:-');
for j in 1..col_cnt
loop
v_finaltxt := 'Column Name: '||rpad(upper(rec_tab(j).col_name),30,' ');
case rec_tab(j).col_type
-- if the type of column is varchar2, bind that to our varchar2 variable
when 1 then
dbms_sql.define_column(v_cursor,j,v_v_val,20);
v_finaltxt := v_finaltxt||' Datatype: Varchar2';
-- if the type of the column is number, bind that to our number variable
when 2 then
dbms_sql.define_column(v_cursor,j,v_n_val);
v_finaltxt := v_finaltxt||' Datatype: Number';
-- if the type of the column is date, bind that to our date variable
when 12 then
dbms_sql.define_column(v_cursor,j,v_d_val);
v_finaltxt := v_finaltxt||' Datatype: Date';
-- ...Other types can be added as necessary...
else
-- All other types we'll assume are varchar2 compatible (implicitly converted)
dbms_sql.DEFINE_COLUMN(v_cursor,j,v_v_val,2000);
v_finaltxt := v_finaltxt||' Datatype: Varchar2 (implicit)';
end case;
dbms_output.put_line(v_finaltxt);
end loop;
-- 4. Bind variables
dbms_output.put_line(chr(10)||'4 - Binding in values');
null; -- we have no values to bind in for our test
-- 5. Execute the query to make it identify the data on the database (Selection)
-- Note: This doesn't fetch any data, it just identifies what data is required.
dbms_output.put_line('5 - Executing the query');
dummy := dbms_sql.execute(v_cursor);
-- 6.,7.,8. Fetch the rows of data...
dbms_output.put_line(chr(10)||'6,7 and 8 Fetching Data:-');
loop
-- 6. Fetch next row of data
v_ret := dbms_sql.fetch_rows(v_cursor);
-- If the fetch returned no row then exit the loop
exit when v_ret = 0;
-- 7. Extract the values from the row
v_finaltxt := null;
-- loop through each of the Projected columns
for j in 1..col_cnt
loop
case rec_tab(j).col_type
-- if it's a varchar2 column
when 1 then
-- read the value into our varchar2 variable
dbms_sql.column_value(v_cursor,j,v_v_val);
v_finaltxt := ltrim(v_finaltxt||','||rpad(v_v_val,20,' '),',');
-- if it's a number column
when 2 then
-- read the value into our number variable
dbms_sql.column_value(v_cursor,j,v_n_val);
v_finaltxt := ltrim(v_finaltxt||','||to_char(v_n_val,'fm999999'),',');
-- if it's a date column
when 12 then
-- read the value into our date variable
dbms_sql.column_value(v_cursor,j,v_d_val);
v_finaltxt := ltrim(v_finaltxt||','||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'),',');
else
-- read the value into our varchar2 variable (assumes it can be implicitly converted)
dbms_sql.column_value(v_cursor,j,v_v_val);
v_finaltxt := ltrim(v_finaltxt||',"'||rpad(v_v_val,20,' ')||'"',',');
end case;
end loop;
dbms_output.put_line(v_finaltxt);
-- 8. Loop to fetch next row
end loop;
-- 9. Close the cursor
dbms_output.put_line(chr(10)||'9 - Closing the cursor');
dbms_sql.close_cursor(v_cursor);
END;
SQL> exec process_cursor('select * from proj_test');
1 - Opening Cursor
2 - Parsing the query
3 - Describing the query
3a - SQL Projection:-
Column Name: ID Datatype: Number
Column Name: RN Datatype: Number
Column Name: NM Datatype: Varchar2
4 - Binding in values
5 - Executing the query
6,7 and 8 Fetching Data:-
1 ,1 ,Fred
1 ,2 ,Bloggs
2 ,1 ,Scott
2 ,2 ,Smith
3 ,1 ,Jim
3 ,2 ,Jones
1 ,3 ,Freddy
1 ,4 ,Fud
9 - Closing the cursor
PL/SQL procedure successfully completed.
So, what's really the point in knowing when SQL Projection occurs in a query?
Well, we get many questions asking "How do I convert rows to columns?" (otherwise known as a pivot) or questions like "How can I get the data back from a dynamic query with different columns?"
Let's look at a regular pivot. We would normally do something like...
SQL> select id
2 ,max(decode(rn,1,nm)) as nm_1
3 ,max(decode(rn,2,nm)) as nm_2
4 from proj_test
5 group by id
6 /
ID NM_1 NM_2
1 Fred Bloggs
2 Scott Smith
3 Jim Jones
(or, in 11g, use the new PIVOT statement)
but many of these questioners don't understand it when they say their issue is that, they have an unknown number of rows and don't know how many columns it will have, and they are told that you can't do that in a single SQL statement. e.g.
SQL> insert into proj_test (id, rn, nm) values (1,3,'Freddy');
1 row created.
SQL> select id
2 ,max(decode(rn,1,nm)) as nm_1
3 ,max(decode(rn,2,nm)) as nm_2
4 from proj_test
5 group by id
6 /
ID NM_1 NM_2
1 Fred Bloggs
2 Scott Smith
3 Jim Jones
... it's not giving us this 3rd entry as a new column and we can only get that by writing the expected columns into the query, but then what if more columns are added after that etc.
If we look back at the steps of a cursor we see again that the description and projection of what columns are returned by a query happens before any data is fetched back.
Because of this, it's not possible to have the query return back a number of columns that are based on the data itself, as no data has been fetched at the point the projection is required.
So, what is the answer to getting an unknown number of columns in the output?
1) The most obvious answer is, don't use SQL to try and pivot your data. Pivoting of data is more of a reporting requirement and most reporting tools include the ability to pivot data either as part of the initial report generation or on-the-fly at the users request. The main point about using the reporting tools is that they query the data first and then the pivoting is simply a case of manipulating the display of those results, which can be dynamically determined by the reporting tool based on what data there is.
2) The other answer is to write dynamic SQL. Because you're not going to know the number of columns, this isn't just a simple case of building up a SQL query as a string and passing it to the EXECUTE IMMEDIATE command within PL/SQL, because you won't have a suitable structure to read the results back into as those structures must have a known number of variables for each of the columns at design time, before the data is know. As such, inside PL/SQL code, you would have to use the DBMS_SQL package, just like in the code above that showed the workings of a cursor, as the columns there are referenced by position rather than name, and you have to deal with each column seperately. What you do with each column is up to you... store them in an array/collection, process them as you get them, or whatever. They key thing though with doing this is that, just like the reporting tools, you would need to process the data first to determine what your SQL projection is, before you execute the query to fetch the data in the format you want e.g.
create or replace procedure dyn_pivot is
v_sql varchar2(32767);
-- cursor to find out the maximum number of projected columns required
-- by looking at the data
cursor cur_proj_test is
select distinct rn
from proj_test
order by rn;
begin
v_sql := 'select id';
for i in cur_proj_test
loop
-- dynamically add to the projection for the query
v_sql := v_sql||',max(decode(rn,'||i.rn||',nm)) as nm_'||i.rn;
end loop;
v_sql := v_sql||' from proj_test group by id order by id';
dbms_output.put_line('Dynamic SQL Statement:-'||chr(10)||v_sql||chr(10)||chr(10));
-- call our DBMS_SQL procedure to process the query with it's dynamic projection
process_cursor(v_sql);
end;
SQL> exec dyn_pivot;
Dynamic SQL Statement:-
select id,max(decode(rn,1,nm)) as nm_1,max(decode(rn,2,nm)) as nm_2,max(decode(rn,3,nm)) as nm_3 from proj_test group by id order by id
1 - Opening Cursor
2 - Parsing the query
3 - Describing the query
3a - SQL Projection:-
Column Name: ID Datatype: Number
Column Name: NM_1 Datatype: Varchar2
Column Name: NM_2 Datatype: Varchar2
Column Name: NM_3 Datatype: Varchar2
4 - Binding in values
5 - Executing the query
6,7 and 8 Fetching Data:-
1 ,Fred ,Bloggs ,Freddy
2 ,Scott ,Smith ,
3 ,Jim ,Jones ,
9 - Closing the cursor
PL/SQL procedure successfully completed.
... and if more data is added ...
SQL> insert into proj_test (id, rn, nm) values (1,4,'Fud');
1 row created.
SQL> exec dyn_pivot;
Dynamic SQL Statement:-
select id,max(decode(rn,1,nm)) as nm_1,max(decode(rn,2,nm)) as nm_2,max(decode(rn,3,nm)) as nm_3,max(decode(rn,4,nm)) as nm_4 from proj_test group by id order by id
1 - Opening Cursor
2 - Parsing the query
3 - Describing the query
3a - SQL Projection:-
Column Name: ID Datatype: Number
Column Name: NM_1 Datatype: Varchar2
Column Name: NM_2 Datatype: Varchar2
Column Name: NM_3 Datatype: Varchar2
Column Name: NM_4 Datatype: Varchar2
4 - Binding in values
5 - Executing the query
6,7 and 8 Fetching Data:-
1 ,Fred ,Bloggs ,Freddy ,Fud
2 ,Scott ,Smith , ,
3 ,Jim ,Jones , ,
9 - Closing the cursor
PL/SQL procedure successfully completed.
Of course there are other methods, using dynamically generated scripts etc. (see Re: 4. How do I convert rows to columns?), but the above simply demonstrates that:-
a) having a dynamic projection requires two passes of the data; one to dynamically generate the query and another to actually query the data,
b) it is not a good idea in most cases as it requires code to handle the results dynamically rather than being able to simply query directly into a known structure or variables, and
c) a simple SQL statement cannot have a dynamic projection.
Most importantly, dynamic queries prevent validation of your queries at the time your code is compiled, so the compiler can't check that the column names are correct or the tables names, or that the actual syntax of the generated query is correct. This only happens at run-time, and depending upon the complexity of your dynamic query, some problems may only be experienced under certain conditions. In effect you are writing queries that are harder to validate and could potentially have bugs in them that would are not apparent until they get to a run time environment. Dynamic queries can also introduce the possibility of SQL injection (a potential security risk), especially if a user is supplying a string value into the query from an interface.
To summarise:-
The projection of an SQL statement must be known by the SQL engine before any data is fetched, so don't expect SQL to magically create columns on-the-fly based on the data it's retrieving back; and, if you find yourself thinking of using dynamic SQL to get around it, just take a step back and see if what you are trying to achieve may be better done elsewhere, such as in a reporting tool or the user interface.
Other articles in the PL/SQL 101 series:-
PL/SQL 101 : Understanding Ref Cursors
PL/SQL 101 : Exception Handlingexcellent article. However there is one thing which is slightly erroneous. You don't need a type to be declared in the database to fetch the data, but you do need to declare a type;
here is one of my unit test scripts that does just that.
DECLARE
PN_CARDAPPL_ID NUMBER;
v_Return Cci_Standard.ref_cursor;
type getcardapplattrval_recordtype
Is record
(cardappl_id ci_cardapplattrvalue.cardappl_ID%TYPE,
tag ci_cardapplattrvalue.tag%TYPE,
value ci_cardapplattrvalue.value%TYPE
getcardapplattrvalue_record getcardapplattrval_recordtype;
BEGIN
PN_CARDAPPL_ID := 1; --value must be supplied
v_Return := CCI_GETCUSTCARD.GETCARDAPPLATTRVALUE(
PN_CARDAPPL_ID => PN_CARDAPPL_ID
loop
fetch v_return
into getcardapplattrvalue_record;
dbms_output.put_line('Cardappl_id=>'||getcardapplattrvalue_record.cardappl_id);
dbms_output.put_line('Tag =>'||getcardapplattrvalue_record.tag);
dbms_output.put_line('Value =>'||getcardapplattrvalue_record.value);
exit when v_Return%NOTFOUND;
end loop;
END; -
SQL server service and SQL agent service
Hi all. If I am going to use a Domain User to start SQl server service and SQL agent service,
does the domain user need to be SYSADMIN ????No. not at all required.
Service account should have below permissions to start SQL service and Agent services.
Log on as a service (SeServiceLogonRight)
Replace a process-level token (SeAssignPrimaryTokenPrivilege)
Bypass traverse checking (SeChangeNotifyPrivilege)
Adjust memory quotas for a process (SeIncreaseQuotaPrivilege)
Permission to start SQL Writer
Permission to read the Event Log service
Permission to read the Remote Procedure Call service
Also please go though the below URL for more information:
http://msdn.microsoft.com/en-us/library/ms143504.aspx#Windows -
Running SQL Loader through PL/SQL
Hi All,
Is there a utility package that can be used to run SQL LOADER through PL/SQL?
RegardsExternal tables are new in 9i.
If you need to call SQL*Loader in 8i, you'd be stuck with the Java stored procedure/ external procedure approach. Of course, this might also be an impetus to upgrade, since 8.1.7 leaves error correction support at the end of the year.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
Execute SQL Loader through PL/SQL Block
I want to run Sql Loader through PL/SQL Block. So Pls. give me solutions.
It's the same as running any other OS command from PL/SQL - you can only do it by using Java. Check out the AskTom site for a good tutorial.
rgds, APC -
SQL server 2014 and Sql 2012 installation on VMWare machine
Hi ,
Please let me know Can we Install SQL Server 2014 RTM version and SQL Server 2012 SP1 On Vmare machine version 9.
Does it Supports on VMware 9 . If yes please give me the links .
Thanks a lotHello,
You can find that on VMware Web site for their high end products only as you can see in the following URL. For VMware
9 you won't find it.
http://www.vmware.com/resources/compatibility/sim/interop_matrix.php
VMware 9 is a PC product that basically allows to install any product that works on Windows 8 and Windows Server 2012 or earlier. VMware 9 introduces support for Windows 8 and Windows 2012.
So, SQL Server 2012 and SQL Server 2012 should install on Windows 8/Windows 2012 RTM with no issues on a VMware 9 virtual machine. Earlier operating systems may require installation of service packs and updates as explained on the following URLs.
https://msdn.microsoft.com/en-us/library/ms143506(v=sql.120).aspx
https://msdn.microsoft.com/en-us/library/ms143506(v=sql.110).aspx
Hope this helps.
Regards,
Alberto Morillo
SQLCoffee.com -
When I had uninstall Sql Server 2008 R2, that time I had uninstalled instances (SQLEXPRESS and MSSQLSERVER) and again installed sql server 2008 r2 setup .
Before uninstalling from control panel >Uninstall program showed two setups
1) Microsoft sql server 2) Microsoft sql server R2 , I uninstalled both.
As i installed SQL R2 again, it is showing only 1 instance ie "Microsoft sql server R2" but the other instance is some how missing -"Microsoft sql server" and
also sql server (SQLEXPRESS) AND sql server Agent(SQLEXPRESS) services from sql server configuration manager are missing
How to retain the missing instance and the above services?
Plz give replayHi Tushar,
I need to ask you a question here.
Why you require SQL Express edition on your machine, if there is no need you can safely ignore it and continue using SQL Server 2008 R2 edition.
Express edition can also get installed if you happen to have installed Visual Studio 2010 for instance.
If you need it then you must install SQL Server Express edition, It is a freeware and can be download from Microsoft website.
BR, Shashikant -
Sql@loader-704 and ORA-12154: error messages when trying to load data with SQL Loader
I have a data base with two tables that is used by Apex 4.2. One table has 800,000 records . The other has 7 million records
The client recently upgraded from Apex 3.2 to Apex 4.2 . We exported/imported the data to the new location with no problems
The source of the data is an old mainframe system; I needed to make changes to the source data and then load the tables.
The first time I loaded the data i did it from a command line with SQL loader
Now when I try to load the data I get this message:
sql@loader-704 Internal error: ulconnect OCISERVERATTACH
ORA-12154: tns:could not resolve the connect identifier specified
I've searched for postings on these error message and they all seem to say that SQL Ldr can't find my TNSNAMES file.
I am able to connect and load data with SQL Developer; so SQL developer is able to find the TNSNAMES file
However SQL Developer will not let me load a file this big
I have also tried to load the file within Apex (SQL Workshop/ Utilities) but again, the file is too big.
So it seems like SQL Loader is the only option
I did find one post online that said to set an environment variable with the path to the TNSNAMES file, but that didn't work..
Not sure what else to try or where to look
thanksHi,
You must have more than one tnsnames file or multiple installations of oracle. What i suggest you do (as I'm sure will be mentioned in ed's link that you were already pointed at) is the following (* i assume you are on windows?)
open a command prompt
set TNS_ADMIN=PATH_TO_DIRECTOT_THAT_CONTAINS_CORRECT_TNSNAMES_FILE (i.e. something like set TNS_ADMIN=c:\oracle\network\admin)
This will tell oracle use the config files you find here and no others
then try sqlldr user/pass@db (in the same dos window)
see if that connects and let us know.
Cheers,
Harry
http://dbaharrison.blogspot.com -
SQL Loader : Trim and Decode functions help please
Hi,
I have to load data from a flat file, for some columns i need to use TRIM and DECODE functions.It is a pipe delimited file.
I get syntax errors (one is below) same error listed for TRIM.
SQL*Loader-350: Syntax error at line xx.
Expecting "," or ")", found "DECODE".
===========
,FINAL_BILL_DATE CHAR(30) "TRIM(:FINAL_BILL_DATE)"
,BUSINESS_ID "DECODE(:BUSINESS_ID,'B',1,'C',2,'E',3,'G',4,'O',5,'R',6,'T',7,'U',8,'H',9,-1)"
Can anyone please help.
Thanks
CherrishHello Cherrish.
The error you are receiving leads me to believe that at some point prior to the DECODE on the line for BUSINESS_ID, probably some line even before the FINAL_BILL_DATE line, there a syntactical error causing the quotes before the DECODE to actually terminate some other syntax. Without all of the lines that could actually contribute to this, including the header details, this is the best I can advise.
Hope this helps,
Luke
Please mark the answer as helpful or answered if it is so. If not, provide additional details.
Always try to provide create table and insert table statements to help the forum members help you better. -
Request: PL/SQL, External Table and SQL Loader
I see lately Questions asked in SQL and PL/SQL forum regarding SQL Loader and External Table are being moved to {forum:id=732}.
Being an PL/SQL developer for some time now i feel External Table (and if i may, SQL Loader and DBMS_DATAPUMP) are very much an integral part of a PL/SQL development and the question related to these topics are well suited in SQL and PL/SQL forum. Even in SQL and PL/SQL FAQ we have exclusive content that discuss on these topics {message:id=9360007}
So i would like to request the moderators to consider not moving such questions out of the SQL and PL/SQL forum.
Thanks,
Karthick.Karthick_Arp wrote:
I see lately Questions asked in SQL and PL/SQL forum regarding SQL Loader and External Table are being moved to {forum:id=732}.
Being an PL/SQL developer for some time now i feel External Table (and if i may, SQL Loader and DBMS_DATAPUMP) are very much an integral part of a PL/SQL development and the question related to these topics are well suited in SQL and PL/SQL forum. Even in SQL and PL/SQL FAQ we have exclusive content that discuss on these topics {message:id=9360007}
So i would like to request the moderators to consider not moving such questions out of the SQL and PL/SQL forum.
Thanks,
Karthick.Not sure which moderators are moving them... cos it ain't me. I'm quite happy to leave those there. -
Hi,
I am using SQL loader to insert data from a flat file.
While searching for other options in sqlloader. I have found Zoned datatype.
If I have some negative value in flat file like 98765.4321-
now I have searched on internet and found if I write Zoned(9,4) to store above value, it will store the negative sign also? Just want to confirm if it is? as I have seen readed is it does take in Zoned datatype but not in Zoned external.
So if you can confirm or send me some link for same.
Also I want to write nullif for more then one value for one column. What I found in internet is 2 approach.
1) or condition in nullif. For example
TerminationDate POSITION(58:63) DATE(6) "YYMMDD"
NULLIF(TerminationDate = "000000" OR TerminationDate = "999999" OR
TerminationDate = "731014")
2) Decode the value. For example
TerminationDate POSITION(58:63) "decode (:TerminationDate,
'000000', NULL, '999999', NULL, '731014', NULL, to_date (:TerminationDate,
'YYMMDD') )"
Which one is the better approach out of these 2?
Thanksuser539644 wrote:
1) or condition in nullif. For example
TerminationDate POSITION(58:63) DATE(6) "YYMMDD"
NULLIF(TerminationDate = "000000" OR TerminationDate = "999999" OR
TerminationDate = "731014")
2) Decode the value. For example
TerminationDate POSITION(58:63) "decode (:TerminationDate,
'000000', NULL, '999999', NULL, '731014', NULL, to_date (:TerminationDate,
'YYMMDD') )"
Which one is the better approach out of these 2?The best one is the one that works correctly with good performance and maintainability is the best one - beyond that you decide.
I personally like the NULLIF answer better because I find DECODE to be hard to work with; if you must use DECODE and have a recent version of the database use CASE instead. -
Loading DAO and SQL on demand for the request
Hi,
I have a requirement, where I need to load the SQL queries for the specific DAO on demand when the request has been made. This will ensure that I am not loading all the objects as I will be loading only the objects which I am going to work with. That is the main idea behind this operation. I am using JPA for back-end which connects to Oracle DB. Whether it will be better to load all the module specific DAO's on-demand using lazy-init="true" in Spring and load the specific SQL queries for those DAO's? In hibernate we are using named queries. Hence, please do suggest me how we can go about this?
Whether it is better to load the DAOImpl and specific SQL for those DAO on demand (lazy-init="true")?If that is the case how we can do it? Please give me some examples on this? Whether we need to configure the named SQL queries in text file or XML? Which one will be better.Also suggest me which will be the best way of handling this? Any ideas are really appreciated.
Thanks.I am unclear on if this question is a JPA question or a Spring/Hibernate question. If it is the later, you might try asking elsewhere, as this is a TopLink/JPA forum - TopLink is a JPA provider that includes EclipseLink. If it is JPA, you might make your question more clear, as JPA does not allow defining named queries in a text file and defining a query will not return entities from the database. JPA does allow defining queries in orm.xml or though annations on the entities themselves, and in JPA 2.1, you can add named queries in code. And entities are only returned when the query is executed, so you might want to explain a bit more what you are trying to avoid loading.
Best Regards,
Chris
Maybe you are looking for
-
Hi, I need to lock the Custom table based on company code. I have an Internal table with list of company codes. Now I need to lock the table for All the company codes there in ITAB. I am doing like this. Before Save: LOOP AT it_lock INTO wa_t001.
-
I know! This is not a WebDB discussion group. However, as no such group to my knowledge exists - this one is possibly the closest I can get: HELP!! How do I create longer fields for my "News items"? If I try to publish long sized News I receive an Er
-
Finding hidden mailboxes On My Mac
Important set of boxes under "Delivered" have disappeared since yesterday, without me deliberately making any change. Messages can still be searched for and shown individually. Show/hide doesn't work from pull-down or screen; nor does restarting mail
-
How come shockwave flash wont load
When I open chrome, and try to go to youtube it comes up with a yellow toolbar looking thing that says "could not load Shockwave Flash". What do I do?
-
The Wi-fi tab in the settings menu is greyed out and is locked-I cannot even access the contents of the Wi-fi tab. It says "No Wi-Fi" across from the label of the tab. I have reset "all" settings and "network" settings. What can I do?