Compensation of the sequences, run the sql script
HelloI use OWB 10.1.0.4.0 and I use a sequence to create a surrogate key in my paintings. For the tabels deleted during the process, I want these sequences set to 1 again.
Is it possible to run an sql script in a mapping or the flow of process (with a drop, create, grant the declaration for the sequence)?
Thanks in advance,
Arjan
Write these SQL statements in a procedure and the procedure in the import map.
Tags: Business Intelligence
Similar Questions
-
I choose the computer name of the machine running a SQL script
Hello. I am looking for a way to select the computer name of the machine running a SQL script. Is this possible?
I tried the following, but it does not work. Any suggestions?
Select % computername % of double;http://www.Oracle.com/technology/oramag/code/tips2003/011903.html
Check this link see if it helps.
Concerning
REDA
-
call a batch file in the sql scripts
Hi friends,
I'm looking for a way to call any batch file in sql scripts. I avoid using the DBMS_SCHEDULER package because my application server and database server are deparaments.
I use the sql script using the server.plz application.
Ah, I see. Of course, this explains everything.
Now to be serious: there is no way to run a batch SQL script. The Tools that present SQL statements to the database are often able to do; host in SQL * Plus may issue commands to the OS, the host of builtin forms is it too and with dbms_scheduler , you can run a shell script on the database server.
So depending on the tools you use, there are several ways to run the OS commands. So far you didn't tell us what you want to do with what tools in the version you want to do. So to only answer is: it is not possible. You cannot run a simple SQL command script.
see you soon
-
How to accept entries of user of the sql script
I want to create Tablespace using the sql script, but the location of the data file that I need to accept the user. (for the location of the data file).
How can I accept the user input to pl/sql.
Example:
Here, I need to accept the location of the user data file IE: "H:\ORACLE_DATA\FRSDB\TSPACE_INDI_D1_01.dbf".CREATE TABLESPACE TSPACE_INDIA LOGGING DATAFILE 'H:\ORACLE_DATA\FRSDB\TSPACE_INDI_D1_01.dbf' SIZE 500M AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL;
Maybe something like this...
declare flocation varchar2(300) := '&Enter_The_Path'; begin EXECUTE IMMEDIATE 'CREATE TABLESPACE SRC_TSPACE_INDIA LOGGING DATAFILE '''||flocation|| '\SRC_TSPACE_INDI_D1_01.dbf'' SIZE 500M AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL'; end;
You will need to properly explain the quotes in your channel and also make sure you have spaces where they should be (for example, after the key word of the DATA file).
You'd better start with something like this:
set serverout on declare flocation varchar2(300) := '&Enter_The_Path'; v_sql varchar2(32767); begin v_sql := 'CREATE TABLESPACE SRC_TSPACE_INDIA LOGGING DATAFILE '''||flocation|| '\SRC_TSPACE_INDI_D1_01.dbf'' SIZE 500M AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL'; dbms_output.put_line(v_sql); end;
and see what SQL it generates. When you're happy it generates a valid statement, then you can replace the statement dbms_output with your immediate statement execution.
-
Effect of NLS_LANG in the SQL scripts
DB version: 11.2.0.2
Platform: RHEL 5.6
We have a software provider who occasionally sends SQL scripts to deploy.
The scripts contain usually few CFDS and many LMD
Textpad, I can see, the LMD (inserts, updates) in the SQL Script. It usually contains some non-English characters (Dutch, German, French) as
They always ask us set NLS_LANG as follows.'Übersicht Buchungssätze' . 'Fehler beim Löschen der zugeordneten Referenzen!'
After INSERTION, I questioned the inserted values of PL/SQL Developer. Values appear exactly as it appears in the SQL Script text file as shown above.export NLS_LANG="AMERICAN_AMERICA.WE8ISO8859P15"
So, what was the effect of the NLS_LANG setting? What would have happened if I had not set NLS_LANG?
NLS in the DB InfoSQL > select * from nls_Database_parameters; PARAMETER VALUE ------------------------------ ---------------------------------------- NLS_LANGUAGE ENGLISH NLS_TERRITORY UNITED KINGDOM NLS_CURRENCY # NLS_ISO_CURRENCY UNITED KINGDOM NLS_NUMERIC_CHARACTERS ., NLS_CHARACTERSET AL32UTF8 NLS_CALENDAR GREGORIAN NLS_DATE_FORMAT DD-MON-RR NLS_DATE_LANGUAGE ENGLISH NLS_SORT BINARY NLS_TIME_FORMAT HH24.MI.SSXFF NLS_TIMESTAMP_FORMAT DD-MON-RR HH24.MI.SSXFF NLS_TIME_TZ_FORMAT HH24.MI.SSXFF TZR NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH24.MI.SSXFF TZR NLS_NCHAR_CHARACTERSET AL16UTF16 NLS_DUAL_CURRENCY ? NLS_COMP BINARY NLS_LENGTH_SEMANTICS BYTE NLS_NCHAR_CONV_EXCP FALSE NLS_RDBMS_VERSION 11.2.0.2.0 20 rows selected.
If our supplier had chosen to save the script with the UTF-8 encoding, then, we have set NLS_LANG. Right?
Evil. You need to AMERICAN_AMERICA. AL32UTF8. If you don't set NLS_LANG, it uses default AMERICAN_AMERICA. US7ASCII. Therefore, only pure ASCII 7-bit scripts can be executed in such environment. The Oracle Client does not use the default database character. It uses the platform default (usually US7ASCII) or UTF-16 in the case of JDBC, ODBC (Unicode mode) and ODP .NET pilots.
-Sergiusz
-
Where the SQL Scripts running after the installation of the ODAC for Oracle Client?
I just installed ODAC for Oracle Client on a windows server that runs a database of sql server, allowing developers to connect to a web application to an Oracle/Unix database. The installation States to run SQL scripts, located in the $ORACLE_HOME\ASP.NET\SQL directory after installation. I don't know where to run them? On the ORACLE DB on the Unix server? If someone could let me know, I'd appreciate it. Thank you.You must run on the Oracle database server, but they are necessary only if you use Oracle for ASP.NET providers.
If you just install the software, so you can use OLEDB with SQL Server linked server, for example, you don't need them. What do you need to run although if this is the case is the oramtsadmin.sql script that creates the objects used by the Oracle MTS Recovery Service (if you do not have these objects created on the database) that SQL Server uses a distributed transaction for Oracle connections I think.
It will be useful,
Greg -
How to assign the variable in the SQL script?
I have the below running to generate the XML from the file.
I'm queue in the order of the coil, the output to a file named file1.xml. I invoke this SQL script from a shell script, I will pass variable association 3rd since the shell script which I want to use in the file ' & & 3'.xml. Help me set this variable to the DIGITAL field in this SQL script and how can I add to the command of the coil?set long 100 set pages 0 set trimspool on set serveroutput on set echo off set terminal off variable out CLOB begin pack.proc('&&1','&&2',:out); end; / spool /dir/loc/file1.xml select :out from dual; spool off
set long 100 set pages 0 set trimspool on set serveroutput on set echo off set terminal off variable out CLOB define var1='&1' -- to allow for more readable code define var2='&2' define var3 ='&3' begin pack.proc('&var1','&var2',:out); end; / spool /dir/loc/file&var3..xml -- note the substition variable has . appended print out spool off
------------
Sybrand Bakker
Senior Oracle DBA -
How to pass arguments to the SQL Script in command prompt
I don't know about the ' & nom_de_variable "to request a value in the command line.
But, how can I pass arguments from the command line for the following script to the command - prompt
Example:
ex_proc. SQL
CREATE OR REPLACE PROCEDURE ex_proc (employee_id NUMBE IN)
IS
v_emp_id Number (38);
BEGIN
v_emp_id: = employe_id;
UPDATE emp_employee SET sal = 2000 WHERE emp_id = v_emp_id;
END;
/
call_ex_proc. SQL
Appellant for procedure above:
BEGIN
ex_proc (100); -The employee id is 100.
END;
/
Here are the General controls that we use to run the scripts above-
SQL > @ex_proc.sql
SQL > @call_ex_proc.sql
But my requirement is to pass the employee id as an argument in the command line as.
SQL > @call_ex_proc.sql 100
Is it possible to pass command line arguments?Usually this question start with reading documentation, wouldn't it?
Solomon Yakobson showed you the method gross and unreadable.
You will use best
set
= '& 1' '. -use &
in the rest of the code ----------
Sybrand Bakker
Senior Oracle DBA -
Insert the SQL script for BLOBs
Hello
I managed to upload my word and pdf documents in the database using blob support APEX and have these columns in the MY_DOC table
, VARCHAR2 (400) FILE NAME NOT NULL
BLOB_CONTENT BLOB
, VARCHAR2 (48) MIME_TYPE
Now I want to migrate the data to another environment by using an insert SQL script, how to respond to the BLOB column in the insert script?
Kind regards
ADEYou cannot migrate data blob with insertion of scripts. However, you can achieve this by using the datapump...
Example:
expdp sysadm/sysadm tables =
dumpfile = dump.dmp logfile = expdp_dump.log patterns =
Impdp sysadm/sysadm dumpfile = dump.dmpBR,
Nico
-
Hi all
Oracle db 10g
I have a sql script that is like
In the above script as I must include conditionsCURSOR c IS select s.sid,s.serial# from gv$session s, gv$process p, gv$locked_object l where l.session_id = s.sid and floor(mod(last_call_et,3600)/60) > 3 and l.object_id in (438239,332790,46237,362927) and s.module in ('JSWPKSLIPN','OEXOEORD','ICPCKLOT','JSWPKSHIPHRM','JAINEORD') and s.status='INACTIVE' and s.paddr = p.addr; c_row c%ROWTYPE; l_sql VARCHAR2(100); BEGIN OPEN c; LOOP FETCH c INTO c_row; EXIT WHEN c%NOTFOUND; l_sql := 'alter system kill session '''||c_row.sessionid||','||c_row.serialid||''''; EXECUTE IMMEDIATE l_sql; END LOOP; CLOSE c; END; /
So that the cursor c gets all the inactiive and serial No. session id and put loop and kills the session... ? He must check the two conditions and if any condition returns the lines, he should kill?s.module in ('JSWPKSLIPN','OEXOEORD','ICPCKLOT','JSWPKSHIPHRM','JAINEORD') and s.last_call_et/1800 > 1 and s.action like 'FRM%' and s.status='INACTIVE'
Thank you
Baskar.lLoops of slider like the one you posted since out-of-date Oracle 8i over 12 years ago.
Learn how to process rows tables not simple.
http://www.morganslibrary.org/reference/array_processing.html -
Running PL/SQL scripts...
Hello:
I'm new to PL/SQL and am learning by writing that a few basic Queries.I using TOAD as a tool to write queries I got stuck in this query I posted below.
Here I have a table with data.
EMPLOYEE_ID SALARY BONUS
----------- ---------- ----------
90-1000
100 2000
110 1890
130 2132
120 1255
I wrote a query which take the value from the table (of particular employee_id) salary and multi with 0.01 and once again will store in the variable bonus (so far everything works fine).
but when I execute the script with the function to update its time consuming process (ends without result).
DECLARE
bonus NUMBER (8.2);
emp_id NUMBER (6): = 100;
BEGIN
SELECT salary * 0.10 IN bonus
Employees
WHERE employee_id = emp_id;
dbms_output.put_line (bonus);
update set employees.bonus = bonus employees where employee_id = emp_id;
END;
I tried the same thing through the sql-plus tool.
I stored the file above in note ++ (.sql extension) and through sql-plus I tried to run
SQL > @[path] [file]
but this does not work please help me in this. Please help me solve both ways...
See you soon...
It shouldn't take long at all.
SQL > create table emp2 in select * from emp;
Table created.
SQL > ed c:\give_bonus.sql
In my case, I have...
>
declare
number of bonuses;
emp_id number: = 7788;
Start
Select sal * 1.1
as a bonus
from emp2
where empno = emp_id;dbms_output.put_line ('Sal with bonus: ' | bonus);
Update emp2
Sal value = give_bonus.bonus
where empno = emp_id;commit;
end;
/And then again in SQL * more I call it...
SQL > set timing on
SQL > @c:\give_bonus.sql
SAL with bonus: 3300PL/SQL procedure successfully completed.
Elapsed time: 00:00:00.03
Very fast.
Perhaps you lack the ' / ' the end of your script that tells SQL * Plus to run the code? And he's sitting there waiting for input?
-
Hello
I use oracle10g (10.2.0.4) in windows xp service pack 2. I create a batch file and I want to as the next line of my script to run within a period of 5 to 10 seconds. can someone help me do the command in windows?Syntax SQL * Plus on Windows is:
host sleep
A better solution would be to use DBMS_LOCK. SLEEP because it is a PL/SQL package that runs in the database and do not depend on some OS executable.
Edited by: P. Forstmann on 28 Dec. 2010 08:50
-
I have a simple select statement that should be automated (execution per day) in an oracle database. It essentially selects data in multiple tables and the resulting data then fill an excel file. How to achieve them.
I guess I can write a cron job. Are there other ways easirer to do? Can I do this using the OEM?
Thank you!You can use DBMS_JOB / DBMS_SCHEDULER to automate one of the PL/SQL solutions, Yes. If you do not specifically need an Excel file and need a source for DTS, you can certainly write a small procedure that stores the results of a query in a table and then use DTS to extract the data from the Oracle table.
Justin
-
How to view and current directory to run an SQL script
Hello
Questions about a few simple things in sql command line plusent, but they are really hard to find in the documentation:
1. is there an easy way to set an environment variable changing a working directory where a script is running?
2. How can I view path environment?
Kind regards
ValerieSQLPATH? Example:
C:\>type \tmp\test.sql select 1 from dual; C:\>sqlplus test/test SQL*Plus: Release 10.2.0.1.0 - Production on Fri Aug 28 11:47:56 2009 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production SQL> @test SP2-0310: unable to open file "test.sql" SQL> exit Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production C:\>set SQLPATH=c:\tmp C:\>sqlplus test/test SQL*Plus: Release 10.2.0.1.0 - Production on Fri Aug 28 11:48:19 2009 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production SQL> @test 1 ---------- 1 SQL>
-
can the run/run .sql script in another application?
Hello..
I have a problem to run my .sql script (for example: @c:\Users\test.sql) in my netbeans application. There is no problem when I want to run/run my sql query (for example: "select * from...").
But when I want to run my script, no presentation of the result. my script content my query to export to the csv file.
script: @c:\Users\test.sql
in the script:
coil c:\Users\test.csv;
' Select ' ' ' | LOT_NUMBER | « «, » » || DEVICENUMBER | « «, » » || DEVICENAME | « «, » » || STEP_NAME | « «, » » || INSERT_DATE | « «, » » || STATUS | « «, » » || DISPOSEDBY | « «, » » || ACCEPTBY | « «, » » || AVAILABLE | « «, » » || GENDISPOSITION | » » »
of RF_LOT_ON_HOLD_LIST;
spool off;
Thank you.
bunch
Yes, we know what talking about your question.
a .sql script is just a plain text file containing everything you want. The code in it can be a pure SQL statements, it may contain of the PL/SQL code, and it can also include SQL * more specific orders (keep in mind SQL * more is a tool, not a language, so that these commands are specific to this tool and other tools which can also interpret the same commands).
Not quite sure how your question relates to this blog, as this blog is showing the code that gets the data in JSON format in a jqGrid (jQuery grid?) and then exports the data in an Excel file.
What you're trying to do is to take a series of SQL * Plus and SQL statements in a text file and generate a CSV file from them.
As already mentioned, SPOOL is a SQL * more order, specific to SQL * more command line tool. The database itself has no idea what "spool" means, while passing to the database somehow does not work. I also doubt that netbeans knows what that means, either.
So, in short, how you try to do, not you cannot.
Maybe you are looking for
-
The download icon turns on when I do not download and it seems suspicious
This happens regularly and it is brief. I tried to scan my PC (Win 7) with Malware Bytes and AVG, but nothing was found.
-
Display with Equium A100-PSAABE problem
I have an Equium A100 - model PSAABE.The display of the Office covers only 2/3 of the display screen. On the right of the screen is a blackstrip 2 ".I have treid graphics download drivers display Intel, but it did not work.All the settings seem to be
-
sending digits throug series? Help, please
Hey everyone... I have trouble... I would like to send to labview via a serial port 2 small screens such as those that can show only numbers from 0 to 9. So I have thoes 2 screens and I would, if I have a button... and if I turn 67... He's going to s
-
Won't copy even if she looks like her do something. Error message reported that incorrect paper size has been used. All other functions seem fine. Just bought.
-
Hello How can I see and check on my PHOTOSMART c4380 printer-scanner-copier ink levels?