top 10 SQL only for PeopleSoft
Helloon HRCM91, tools 8.52 on Oracle DB 11 G R2,.
How to query the Oracle DB to have 10 albums SQL only for PeopleSoft?
There are actually in v$ sqlarea all text in sql. How to choose only those of PeopleSoft?
Thank you.
You can use CWA and ADDM reports. That would be advice you which ran for schema SYSADM (PeopleSoft) since the record names. you will find many other details as well.
Thank you
Tags: Oracle Applications
Similar Questions
-
Where is the best place to put the code pl/sql only for after the events of the insert?
Hi, I can not use database triggers, but I need to run pl/sql code only after an insertion.
I think I need to create a process in the page that inserts into my table, but how do I know if the page is inserting or editing?
Now I have 3 process: (the tablename parameter is in_incidencias)
After the execution of
10 get PK blocked anonymous PL/SQL
30 process row IN_INCIDENCIAS
page 40 of reset
What kind of process that I need to create, and how can I know if there is a new record to insert?
Thanks in advanceDo not be sorry, that this forum is for all kinds of developers :) I am fairly new to APEX.
When you create a process on your page, you choose ' PL/SQL', click 'Next', and then give you it a name, a sequence number and a point of execution (after Submit, generally). You click 'Next' again and then you can code your process. Encode you, click again on "next". Now you have success and failure messages, you can put whatever you want in here. Click 'Next' again, and you finally processing Conditions. Select the button in the field when you press button and're you good to go. If you never want your process to shoot several buttons, and they all have a request, you can also choose the "Request is contained in the Expression 1" Type of Condition and type a comma list of applications in the field of the Expression 1 (something like "CREATE, SAVE", but without the quotation mark).
With respect to the code of the process itself, I still have to code an email sending process myself, but this thread contains the basics that you need, with useful links to the official documentation.
Hope this helps,
Matt -
secconf.Sql. If it will work for upgrades or only for new databases?
Hello
I'm reviewing oracle 11g features and found that few things need special attention, such as checking the settings and the changes in the default profile.
Looking at the secconf.sql file, I found this note
REM only invoked for databases of newly created, not for upgrade of databases
My question is
(1) if I update a database to Oracle 10 G to Oracle 11 G, will, these changes in profile by default and the audit take place or not?
(2) these 11 G changes will happen if we create new databases using DBCA?
Thank you
DelphineIf you take a peek of scripts by calling secconf.sql in 11.2
/rdbms/admin, you see that secconf.sql can be run from catuprgd.sql with the following calling sequence: catupgrd. SQL-> catproc.sql-> catpexec.sql-> execseq.sql-> secconf.sql
You can retrieve it with:
pwd /u01/app/oracle/product/11.2.0/dbhome_1/rdbms/admin [oracle@lx01 admin]$ grep secconf.sql *.sql execsec.sql:Rem Only run the secconf.sql script for new database creations, not execsec.sql: :secconf_name := '@secconf.sql'; secconf.sql:Rem $Header: rdbms/admin/secconf.sql /main/3 2008/10/26 23:05:27 apsrivas Exp $ secconf.sql:Rem secconf.sql secconf.sql:Rem secconf.sql - SECure CONFiguration script [oracle@lx01 admin]$ grep execsec.sql *.sql catpexec.sql:@@execsec.sql execsec.sql:Rem $Header: execsec.sql 12-jun-2006.13:39:34 rburns Exp $ execsec.sql:Rem execsec.sql execsec.sql:Rem execsec.sql - secure configuration settings [oracle@lx01 admin]$ grep catpexec.sql *.sql catpexec.sql:Rem $Header: catpexec.sql 06-jan-2007.20:57:33 rburns Exp $ catpexec.sql:Rem catpexec.sql catpexec.sql:Rem catpexec.sql - CATProc EXECute pl/sql blocks catproc.sql:@@catpexec.sql --CATFILE -X execcr.sql:Rem Run from catpexec.sql (catproc.sql) [oracle@lx01 admin]$ grep catproc.sql catupgrd.sql @@catproc.sql --CATFILE -X
Thus, it seems that catupgrd.sql still works secconf.sql. Given that catuprgd.sql is THE upgrade script (see http://download.oracle.com/docs/cd/E11882_01/server.112/e10820/scripts004.htm#sthref3623), it seems that this secconf.sql is still running.
But this is not the case if you read execsec.sql code and comments:
Rem Only run the secconf.sql script for new database creations, not Rem for upgrades or any other reruns of catproc.sql. The version column Rem in registry$ is NULL while catproc.sql is running the first time Rem on a new database. VARIABLE secconf_name VARCHAR2(256) COLUMN :secconf_name NEW_VALUE secconf_file NOPRINT DECLARE p_version varchar2(30); BEGIN :secconf_name := '@nothing.sql'; SELECT version INTO p_version FROM registry$ WHERE cid='CATPROC'; IF p_version IS NULL THEN :secconf_name := '@secconf.sql'; END IF; END; / SELECT :secconf_name FROM DUAL; @&secconf_file
In the case of database upgrade registry .version $ is not null and above the code will run nothing.sql instead of secconf.sql:
[oracle@lx01 admin]$ cat nothing.sql Rem $Header: nothing.sql 18-oct-2001.09:57:38 Exp $
It is therefore very likely that secconf.sql is not running during the 11.2 database upgrade (I think that the same should apply to 11.1).
-
Single SQL query for the analysis of the date of customs declaration under the table of Stock codes
Dear all,
Please tell us a single SQL query for the below,
We have a Table of Stock as shown below,
STOCK_TABLE
ITEM_CODE
(item code)
BAT_NO
(lot no.)
TXN_CODE
(transaction code)
DOC_NO
(number)
BOE_DT
(date of the customs declaration)
I1
B1
I1
I2
I3
B70
I4
B80
I5
B90
T102
1234
JULY 2, 2015
I6
B100
We have to find the date of customs declaration (i.e. the date when the items have come under this particular table) for items that are not attached to any document (that is, who have TXN_CODE, DOC_NO and BOE_DT fields with a NULL value).
For each item in the table of actions, which is not attached to any document, the customs declaration date is calculated as follows.
- If (code section, lot number) combination is present under HISTORY_TABLE, the date of customs declaration will receive the UPDT_DT, the transaction code (TXN_CODE) is an IN or transactions (which can be analyzed from the TRANSACTIONS table).
- If (code section, lot number) combination is NOT currently at the HISTORY_TABLE (or) the transaction code respective to item - batch number combination code is an operation then customs declaration date will be the date of the document (DOC_DT) that we receive from one of the 3 tables IN_TABLE_HEAD that contains the element of that particular lot.
- If the case 1 and case 2 fails, our customs declaration date will be the last date of document (DOC_DT) that we receive from one of the 3 tables IN_TABLE_HEAD containing that particular item and the BAT_NO in expected results will be that corresponding to this document, as appropriate, to another NULL.
- If the case 1 or case 2 is successful, the value of the last field (in the output expected, shown further below) BATCH_YN will be 'Y', because it fits the lot. Otherwise it will be 'n'.
-
How to create a validation only for the lines that are created in a table
Hi all
I have a simple question. Is it possible to create a validation in a table that fires only for created?
There is a possibility at the APEX 4.1 choose two types of "* execution scope *" is first of all ' * created and updated lines * "and the second is" * all subject lines. "
Thanks in advance!
Kind regards
JiriHello Jiri,
> Is it possible to create a validation in a table that fires only for created?
You can still use the field lines created and updated the and use a PL/SQL Expression condition of:
:APEX$ROW_STATUS = 'C'
You will also need to change the Condition run for each line.
It will be useful,
Arie.-------------------------------------------------------
Be sure to mark the appropriate fix/useful messages. For the long term, it will benefit us all. -
ORA-01461: can bind to a LONG value only for insert into a LONG column
Hello
Oracle XE on RHE dedicated server
Why do I get the error of subject?create table cvDetails( cd_id number(14) primary key, cv_id number(14) constraint education_fk references CvProperties(cv_id), nationality varchar2(230), objectives varchar2(3900), name varchar2(230), fatherName varchar2(230), motherName varchar2(230), dob varchar2(230), gender varchar2(230), mStatus varchar2(230), passportNo varchar2(110), email varchar2(230), phone varchar2(45), mobile varchar2(25), address varchar2(2500), state varchar2(230), zipCode varchar2(230), city varchar2(230), education clob, experience clob, skills clob, languages varchar2(1400), hobbies varchar2(3200), achievements varchar2(3900), references varchar2(3900) ); create sequence cvDetails_seq start with 1 increment by 1; create or replace trigger cvDetails_trig before insert on cvDetails referencing new as new for each row begin select cvDetails_seq.nextval into :new.cd_id from dual; end; /
Thank you in anticipation>
in any case, I checked manually according to your instructions and found that this objective column is of character input more than specified.
>
Glad you found the problem, but I hope that you learned a lesson that is time consuming.It must be remembered that we have no access to your environment. If we do not know which servers, clients, tables and users that you use.
It may seem simple to you but doesn't realize that you provide us with two slightly different versions of the cvDetails table.The original post had this
>
objectives varchar2 (3900).
>
But when you have provided your 'cvDetails desc' journal text has
>
OBJECTIVES VARCHAR2 (3950)
>
It is the same table that you started with how the column suddenly grow 50 bytes?
This means that you did from different parts of the present in the two schemas or on two servers or you change the table between the two.You can't address properly when you do this. By chance it is the column that you said is now the problem.
In SQL, the maximum length of a VARCHAR2 is 4000 bytes; no characters but bytes. Nothing more than 4000 bytes would probably be a LONG in the generic sense.If your error
>
Re: ORA-01461: can bind to a LONG value only for insert into a LONG column
>
means that you try to 'bind a LONG value' to a column VARCHAR2 and you can't you can 'bind a LONG value only for insert in a LONG column.In the proper context, the error makes sense.
You probably have a problem with
ps.setString(2, objectives);
because the 'objectives' has a length of more than 4000 bytes.
Remember this answer from you?
>
I have read and found that there may be a problem with the driver JDBC or Characterset. Am I wrong?
>
The 'Hello' ASCII string is five characters and five bytes because the ASCII code is a set of characters in a single byte. The same string internally in Java is five characters but ten bytes because Java uses UTF16.So, if the character set of the data itself is double-byte character set then anything more than 2000 characters (4000 bytes) is a "LONG". And if your column is defined as VARCHAR2 (3950), which means bytes a doublel-byte character set which are characters of 1975.
Then you said in a response later
>
I checked by the SNA Server and oracle that are both of the same but new thing I found is that oracle does not allow more than one clob column in a table. Is this true?
>
Somehow a hypothesis has crept it that the problem was not a driver JDBC or Charaterset, but because you can not have more than one clob column in a table.You could have easily tested for yourself by doing what P. Forstmann - tried to create a table and see.
Then you completely ignored my advice
>
I suggest to you isolate the columns actually causing the problem.
Change your code to insert only a few columns. When it works, add more than a few columns.
This will then tell you which column or the columns are at the origin of the problem.
Display the results once you determine a column that causes the error.
>
When you have finally made the simplest things, you have found what was causing the problem almost immediately.Many times you don't need 'experts' - you must use a rigorous, methodical, process step by step.
ALWAYS, ALWAYS, ALWAYS reduce the simplest possible code example that illustrates the problem.
If you had followed this a rule would have probably found you the problem and makes you look like the 'expert '.There are no shortcuts.
-
Installation of SQL Server for the virtual Center Server
Hi all
We bought 16 x 2 for ESX server CPU licenses. So, I will prepare a database of virtual server of the Management Center 16 guests. As SQL Server 2005 Express is installed during installation of Virtual Center Server but VMware is recommended for use only for 5 guests.
So I would like to prepare a database of SQL for VC server, please help me how to make the database to the virtual Center Server. Are there special tables, configuration, permissions. I have no experience with databases then how should I go with it. Is there a guide for it. The ESX Server installation guide explains only create ODBC connections.
Please help me with this I would be very obliged.
I know that the procedure is restrited 2 steps (1 and 2) on page 68, but you need to install and configure SQL Server for your business standard (I guess asking the C: or D: and data/newspapers on E :). I'm not going to explain better how to install SQL Server on a server. For the SQL Server database:
Step 1: you create a database storing the files on the right disk (with at least 30 GB) with a default database size to the size defined by the "Calculator" (value of + 15% on the line of your choice statistical level).
Step 2: On your Microsoft SQL Server, create a user of SQL Server database with the database rights of operator (DBO). The default database for the DBO User is that you defined in step 1. Make sure the database user has a role of sysadmin server or the role of database db_ownerfixed on the VirtualCenter database and the MSDB database. The role db_owner on the MSDB database is required for the installation and upgradeonly. This role can be removed after installation or upgrade process iscompleted.
The user must be created for your standard business as service account (password never expires) with a long and complex password.
Other steps in the document are for the ODBC connection.
Creating the tables is made during the installation of VC. Nothing to do. A characteristic is not to stop the SQL Server agent because some tasks are scheduled in the database to 'compact' statistics.
For the record, the database is upgraded when installing patches VC creating of new tables, updating of data type or...
-
Out of the queue of SQL * Plus for Excel
I'm out of the queue of SQL * Plus for Excel. The code I use is down. I want that all white space to carve when I open the updated file waiting in Excel. How can I ensure this?
I was reading on the SET TRIM command, but it says that it does not affect the output queued. (http://ss64.com/ora/syntax-sqlplus-set.html)
Is there a way to NOT display whitespace at the beginning and the end of a column in SQL * more? In other words, if I shoot a single column of a record, and a data element is only 3 characters in length, I want to be also 3 characters instead of extending over 40 characters across the width of the column.
The column for your troubleshooting information
IDNUMBER is NUMBER (12)
FIRST is VARCHAR2 (40)
The LAST is VARCHAR2 (60)
Code
SET LINESIZE 100
SET PAGESIZE 0
SET MARKUP HTML PREFORMAT ON
set colsep,
coil c:\prospects.csv
Select '' perspective ID"', '" First"',""finally" "from dual;
Select to_char (p.idnumber), p.first, prospect_view p.last p where idnumber = 164515;
spool offDataHandle wrote:
I'm out of the queue of SQL * Plus for Excel. The code I use is down. I want that all white space to carve when I open the updated file waiting in Excel. How can I ensure this?I was reading on the SET TRIM command, but it says that it does not affect the output queued. (http://ss64.com/ora/syntax-sqlplus-set.html)
TRIM affects the expressions in your SELECT clause. It has nothing to do with the padding of SQL * Plus adds to align the columns upwards.
Is there a way to NOT display whitespace at the beginning and the end of a column in SQL * more? In other words, if I shoot a single column of a record, and a data element is only 3 characters in length, I want to be also 3 characters instead of extending over 40 characters across the width of the column.
Here's a way to make the main request:
SELECT TO_CHAR (idnumber) || ',' || first || ',' || last FROM prospect_view WHERE idnumber = 164515 ;
This will include spaces only if they occur in first or last. Depending on your data and your requriements, you may need to use the FILLING (first) instead of the first, and/or TRIM (finally) instead of the last.
Using this technique, it does not matter what is COLSEP: the query produces a single column.
Use the SQL * more order
SET TRIMSPOOL ON
to keep SQL * more add space after this single column.
-
I need issue of SQL/PLSQL for practice
Hi all
I need to question of SQL/PLSQL for practice; could everything on send me the URL.
I need only the PDF file.
Thank you
GregoryHere is the link for the link of PL/SQL oracle
http://www.Oracle.com/pls/db111/portal.portal_db?selected=5&frame=
IN the section of SQL and PL/SQL language, there is the language Pl/SQL.. PDF reference .you can download... its preety good to start.
-
My Apple Watch shows that I'm up-to-date 2.2.2. Today 3.0 is available. Is this only for new watches?
No - watch OS 3 is available for all models of Apple Watch.
Be patient in waiting for the watch OS update 3 to become available, but start by updating your iPhone on iOS 10:
Update the software on your iPhone, iPad or iPod touch - Apple Support iOS
-
Something hinky (and no, it is not a virus).
Following an 'Upgrade' of v40, I started to experience problems.
When I open Thunderbird, it shows my home, not my Inbox tab. If I select my Inbox, the window does not change. By clicking on the "Read Messages" link does nothing. The only way to view my Inbox is right-click on it and choose to display it in a new tab. Then I have to manually switch to this tab.
Once there, if I select a message and click on delete, the message is * copy * not moved to trash (the message remains open on the screen, while the Trash count rises by 1.) However, if I close Thunderbird, the "deleted" message no longer appears in my Inbox.
By clicking on the buttons "Write" and "Address book" has no effect. By clicking on 'Options' in the menu 'Tools' doesn't do anything, but clicking on 'Account settings' works very well.
Reinstall does not help. The data files are likely be corrupted because delete and recreate them solves the problem... but only for a few days. Then I'm right back where I started.
I have NO add-on (at least, I have not before all the trouble started. I can't confirm now because the ' Add on ' link no longer works) and my PC is virus-free. Thunderbird is the only program behaving oddly.
I even tried * degradation * Thunderbird to v38.2, but it did not help.
Any ideas how to solve this problem? THX.
Quick follow-up.
It seems that the beta version of v40 corrupt my mail files. After that goes back to v38.2 and recreate my accounts from scratch, the problem has not returned.
-
Firefox "Remember password" only for specific accounts
I have multiple gmail accounts and I want firefox to remember the password only for some of them. How do I do that?
Whenever I log in with an account that firefox is not set to remember he asks me every time, and if I want to choose to not me to remember, I should never choose "remember passwords for this site", but I don't want that, since I have a few accounts that I want their password saved.
Hello, you can simply click on "Never remember passwords for this site" - this will not affect your stored passwords currently for gmail but will not show the doorhanger to new passwords Panel...
-
I need BIOS update for Satellite Pro M70 (PSM75E), but only for the BACK
Hello world
Help me!! I'm looking for driver for BACK Bios M70. Does not exist, only for windows and my cell phone is dead.
Bad news, because after 3 minutes, stop!So I have only one solution (with the diskette bootable cd).
So I need the dos version of the BiosThank you
This version is not available on the official support page so only one chance to get it is to contact Toshiba service nearest and ask for help.
Sorry, but I don't see another option for traditional BIOS. -
Drive DVD Toshiba for Windows XP, not only for Vista?
Hello
on www.csd.toshiba.com you can download
DVD Player Toshiba for Windows Vista (v1.20.10, 04/03/2008; 47 M)
but I use Windows XP - is there an available from Toshiba DVD drive?
Windows Media Player says it cannot decode my DVD - ok, I don't want to use the media player at all ;-)
Thank you much for the help. :-)
Hello
I think that the DVD from Toshiba drive was developed only for Vista
I found just that some versions for Vista 32 bit or 64 bit VistaSee you soon
-
Activ battery Toshiba BT only for 30 days
I bought this Kensington Bluetooth USB Micro Adapter product slightly backwards and used under Vista.
Now I have upgraded to Windows7 and when installing it says that he experienced problems with Windows7.Checked the site Web of Kensington and the downloadable driver package is one I have already.
However, when I unzip it, he said: ToshibaBTStack_5_10_08.So, I checked this site for updates.
Found something that might be good drivers, but when I try to download the drivers I get a message indicating that they are for Toshiba laptops only and it will run only 30 days on another device.Could someone enlighten me please on what to do next?
I ask here, because it seems that the origin of drivers from here and there is NO support on the site Web of Kensington at all...Thank you! : o).
Yes, it's true!
Toshiba BT stack is only for Toshiba laptops.
If you need a full version you will need to contact the manufacturer of the device.
In your case, Kensington.
HISTORY_TABLE
ITEM_CODE | BAT_NO |
TXN_CODE
DOC_NO
UPDT_DT
I1
B1
T1
1234
JANUARY 3, 2015
I1
B20
T20
4567
MARCH 3, 2015
I1
B30
T30
7890
FEBRUARY 5, 2015
I2
B40
T20
1234
JANUARY 1, 2015
TRANSACTION
TXN_CODE | TXN_TYPE |
T1 | IN |
T20 |
OFF
T30
ALL THE
T50
IN
T80
IN
T90
IN
T60
ALL THE
T70
ALL THE
T40
ALL THE
IN_TABLE_HEAD_1
H1_SYS_ID (primary key) | TXN_CODE | DOC_NO |
DOC_DATE
H1ID1
T1
1234
JANUARY 1, 2015
H1ID2
T70
1234
FEBRUARY 1, 2015
IN_TABLE_ITEM_1
I1_SYS_ID |
H1_SYS_ID
(foreign key referencing H1_SYS_ID in IN_TABLE_HEAD_1)
ITEM_CODE
I1ID1
H1ID1
I1
I1ID2
H1ID1
I100
I1ID3
H1ID2
I3
IN_TABLE_BATCH_1
B1_SYS_ID | TXN_CODE DOC_NO (now in IN_TABLE_HEAD_1) | BAT_NO |
B1ID1
T1
1234
B1 / can be empty
B1ID2
T70
1234
B70
IN_TABLE_HEAD_2
H2_SYS_ID (primary key) | TXN_CODE |
DOC_NO
DOC_DATE
H2ID1
T30
4567
FEBRUARY 3, 2015
H2ID2
T60
1234
JANUARY 3, 2015
IN_TABLE_ITEM_2
I2_SYS_ID | H2_SYS_ID (foreign key referencing H2_SYS_ID in IN_TABLE_HEAD_2) | ITEM_CODE |
I2ID1 | H2ID1 |
I1
I2ID2
H2ID1
I200
I2ID3
H2ID2
I2
IN_TABLE_BATCH_2
B2_SYS_ID |
I2_SYS_ID
(foreign key referencing I2_SYS_ID in IN_TABLE_ITEM_2)
BAT_NO
B2ID1
I2ID1
B30 / null
B2ID2
I2ID2
B90
B2ID2
I2ID3
B60
IN_TABLE_HEAD_3
H3_SYS_ID (primary key) | TXN_CODE | DOC_NO | DOC_DATE |
H3ID1 |
T50
1234
JANUARY 2, 2015
H3ID2
T80
1234
JANUARY 3, 2015
H3ID3
T90
1234
JANUARY 4, 2015
H3ID4
T40
1234
AUGUST 5, 2015
IN_TABLE_ITEM_3
I3_SYS_ID |
H3_SYS_ID
(foreign key referencing H3_SYS_ID in IN_TABLE_HEAD_3)
ITEM_CODE
BAT_NO
I3ID1
H31D1
I2
B50
I3ID2
H3ID2
I4
B40
I3ID3
H3ID3
I4
I3ID4
H3ID4
I6
There is no IN_TABLE_BATCH_3
Please find below the expected results.
OUTPUT
ITEM_CODE | BAT_NO | TXN_CODE | DOC_NO |
BOE_DT
BATCH_YN
I1
B1
T1
1234
JANUARY 3, 2015
THERE
I1
B30
T30
7890
FEBRUARY 5, 2015
N
I2
B60
T60
1234
JANUARY 3, 2015
N
I3
B70
T70
1234
FEBRUARY 1, 2015
THERE
I4
T90
1234
JANUARY 4, 2015
N
I6
T40
1234
AUGUST 5, 2015
N
Controls database to create the tables above and insert the records.
CREATE TABLE stock_table()item_code VARCHAR2()80),bat_no VARCHAR2()80),txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), boe_dt DATE );
INSERT EN stock_table
VALUES ('I1', 'B1', '', '', '');
INSERT EN stock_table
VALUES ('I1', '', '', '', '');
INSERT IN stock_table
VALUES ('I2', '', '', '', '');
INSERT EN stock_table
VALUES ('I3', 'B70', '', '', '');
INSERT EN stock_table
VALUES ('I4', 'B80', '', '', '');
INSERT EN stock_table
VALUES ('I5', 'B90', 'T102', '1234', '02-JUL-2015');
INSERT EN stock_table
VALUES ('I6', 'B100', '', '', '');
SELECT *
FROM stock_table
CREATE TABLE history_table()item_code VARCHAR2()80),bat_no VARCHAR2()80),txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), updt_dt DATE );
INSERT IN history_table
VALUES ('I1', 'B1', 'T1', '1234', '03-JAN-2015');
INSERT IN history_table
VALUES ('I1', 'B20', 'T20', '4567', '03-MAR-2015');
INSERT IN history_table
VALUES ('I1', 'B30', 'T30', '7890', '05-FEB-2015');
INSERT IN history_table
VALUES ('I2', 'B40', 'T20', '1234', '01-JAN-2015');
SELECT *
FROM history_table
CREATE TABLE transaction1()txn_code VARCHAR()80),txn_type VARCHAR()80));
INSERT INTO transaction1
VALUES ('T1', 'IN');
INSERT INTO transaction1
VALUES ('T20', 'OUT');
INSERT INTO transaction1
VALUES ('T30', 'ALL');
INSERT INTO transaction1
VALUES ('T40', 'ALL');
INSERT INTO transaction1
VALUES ('T50', 'IN');
INSERT INTO transaction1
VALUES ('T60', 'ALL');
INSERT INTO transaction1
VALUES ('T70', 'ALL');
INSERT INTO transaction1
VALUES ('T80', 'IN');
INSERT INTO transaction1
VALUES ('T90', 'IN');
SELECT *
FROM transaction1
CREATE TABLE in_table_head_1()h1_sys_id VARCHAR2()80) PRIMARY KEY,txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), doc_dt DATE );
CREATE TABLE in_table_head_2()h2_sys_id VARCHAR2()80) PRIMARY KEY,txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), doc_dt DATE );
CREATE TABLE in_table_head_3()h3_sys_id VARCHAR2()80) PRIMARY KEY,txn_code VARCHAR2()80),
doc_no VARCHAR2 (80), doc_dt DATE );
INSERT IN in_table_head_1
VALUES ('H1ID1', 'T1', '1234', '01-JAN-2015');
INSERT IN in_table_head_1
VALUES ('H1ID2', 'T70', '1234', '01-FEB-2015');
INSERT IN in_table_head_2
VALUES ('H2ID1', 'T30', '4567', '03-FEB-2015');
INSERT IN in_table_head_2
VALUES ('H2ID2', 'T60', '1234', '03-JAN-2015');
INSERT IN in_table_head_3
VALUES ('H3ID1', 'T50', '1234', '02-JAN-2015');
INSERT IN in_table_head_3
VALUES ('H3ID2', 'T80', '1234', '03-JAN-2015');
INSERT IN in_table_head_3
VALUES ('H3ID3', 'T90', '1234', '05-JAN-2015');
INSERT IN in_table_head_3
VALUES ('H3ID4', 'T40', '1234', '05-AUG-2015');
CREATE TABLE in_table_item_1()i1_sys_id VARCHAR2()80) PRIMARY KEY,
h1_sys_id VARCHAR2 (80) REFERENCES in_table_head_1()h1_sys_id),item_code VARCHAR2()80));
CREATE TABLE in_table_item_2()i2_sys_id VARCHAR2()80) PRIMARY KEY,
h2_sys_id VARCHAR2 (80) REFERENCES in_table_head_2()h2_sys_id),item_code VARCHAR2()80));
CREATE TABLE in_table_item_3(i3_sys_id VARCHAR2(80) PRIMARY KEY,
h3_sys_id VARCHAR2 (80) REFERENCES in_table_head_3()h3_sys_id),item_code VARCHAR2()80),
bat_no VARCHAR2 (80));
INSERT IN in_table_item_1
VALUES ('I1ID1', 'H1ID1', 'I1');
INSERT IN in_table_item_1
VALUES ('I1ID2', 'H1ID1', 'I100');
INSERT IN in_table_item_1
VALUES ('I1ID3', 'H1ID2', 'I3');
INSERT IN in_table_item_2
VALUES ('I2ID1', 'H2ID1', 'I1');
INSERT IN in_table_item_2
VALUES ('I2ID2', 'H2ID1', 'I200');
INSERT IN in_table_item_2
VALUES ('I2ID3', 'H2ID2', 'I2');
INSERT IN in_table_item_3
VALUES ('I3ID1', 'H3ID1', 'I2','B50');
INSERT IN in_table_item_3
VALUES ('I3ID2', 'H3ID2', 'I4','B40');
INSERT IN in_table_item_3
VALUES ('I3ID3', 'H3ID3', 'I4','');
INSERT IN in_table_item_3
VALUES ('I3ID4', 'H3ID4', 'I6','');
SELECT *
FROM in_table_item_1
SELECT *
FROM in_table_item_2
SELECT *
FROM in_table_item_3
CREATE TABLE in_table_batch_1()b1_sys_id VARCHAR2()80) PRIMARY KEY,
txn_code VARCHAR2 (80), doc_no VARCHAR2 (80), bat_no VARCHAR2 (80));
CREATE TABLE in_table_batch_2()b2_sys_id VARCHAR2()80) PRIMARY KEY,
i2_sys_id VARCHAR2 (80) REFERENCES in_table_item_2()i2_sys_id),bat_no VARCHAR2()80));
INSERT IN in_table_batch_1
VALUES ('B1ID1', 'T1', '1234', 'B1');
INSERT IN in_table_batch_1
VALUES ('B1ID2', 'T70', '1234', 'B70');
INSERT IN in_table_batch_2
VALUES ('B2ID1', 'I2ID1', 'B30');
INSERT IN in_table_batch_2
VALUES ('B2ID2', 'I2ID2', 'B90');
INSERT IN in_table_batch_2
VALUES ('B2ID3', 'I2ID3', 'B60');
Please advise a solution for the same.
Thank you and best regards,
Séverine Suresh
very forced (question subfactoring used to allow easy testing/verification - could work with these test data only)
with
case_1 as
(select s.item_code,
s.bat_no,
h.txn_code,
h.doc_no,
h.updt_dt boe_dt,
cases where s.bat_no = h.bat_no then 'Y' else ' n end batch_yn.
cases where h.txn_code is not null
and h.doc_no is not null
and h.updt_dt is not null
then 'case 1' '.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, boe_dt
of w_stock_table
where bat_no is null
or txn_code is null
or doc_no is null
or boe_dt is null
) s
left outer join
w_history_table h
On s.item_code = h.item_code
and s.bat_no = h.bat_no
and exists (select null
of w_transaction1
where txn_code = nvl (s.txn_code, h.txn_code)
and txn_type in ('IN', 'ALL')
)
),
case_2 as
(select s.item_code,
NVL (s.bat_no, h.bat_no) bat_no.
NVL (s.txn_code, h.txn_code) txn_code.
NVL (s.doc_no, h.doc_no) doc_no.
NVL (s.boe_dt, h.updt_dt) updt_dt.
cases where s.bat_no = h.bat_no then 'Y' else ' n end batch_yn.
cases where h.txn_code is not null
and h.doc_no is not null
and h.updt_dt is not null
then 'case 2'.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, boe_dt
of case_1
where refers_to is null
) s
left outer join
w_history_table h
On s.item_code = h.item_code
and exists (select null
of w_transaction1
where txn_code = nvl (s.txn_code, h.txn_code)
and txn_type in ('IN', 'ALL')
)
and not exists (select null
of case_1
where item_code = h.item_code
and bat_no = h.bat_no
and txn_code = h.txn_code
and doc_no = h.doc_no
and updt_dt = h.updt_dt
)
),
case_31 as
(select s1.item_code,
NVL (S1.bat_no, W1.bat_no) bat_no.
NVL (S1.txn_code, W1.txn_code) txn_code.
NVL (S1.doc_no, W1.doc_no) doc_no.
NVL (S1.updt_dt, W1.doc_dt) updt_dt.
cases where s1.bat_no = w1.bat_no then 'Y' else ' n end batch_yn.
cases where w1.txn_code is not null
and w1.doc_no is not null
and w1.doc_dt is not null
then "case 31'.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn, refers_to
of case_2
where refers_to is null
) s1
left outer join
(select i1.item_code, h1.txn_code, h1.doc_no, h1.doc_dt, b1.bat_no
of w_in_table_item_1 i1
inner join
w_in_table_head_1 h1
On i1.h1_sys_id = h1.h1_sys_id
inner join
w_in_table_batch_1 b1
On h1.txn_code = b1.txn_code
and h1.doc_no = b1.doc_no
) w1
On s1.item_code = w1.item_code
),
case_32 as
(select s2.item_code,
NVL (S2.bat_no, W2.bat_no) bat_no.
NVL (S2.txn_code, W2.txn_code) txn_code.
NVL (S2.doc_no, W2.doc_no) doc_no.
NVL (S2.updt_dt, W2.doc_dt) updt_dt.
cases where s2.bat_no = w2.bat_no then 'Y' else ' n end batch_yn.
cases where w2.txn_code is not null
and w2.doc_no is not null
and w2.doc_dt is not null
then "case 32'.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn, refers_to
of case_2
where refers_to is null
) s2
left outer join
(select i2.item_code, h2.txn_code, h2.doc_no, h2.doc_dt, b2.bat_no
of w_in_table_item_2 i2
inner join
w_in_table_head_2 h2
On i2.h2_sys_id = h2.h2_sys_id
inner join
w_in_table_batch_2 b2
On i2.i2_sys_id = b2.i2_sys_id
) w2
On s2.item_code = w2.item_code
),
case_33 as
(select s3.item_code,
w3.bat_no,
NVL (S3.txn_code, w3.txn_code) txn_code.
NVL (S3.doc_no, w3.doc_no) doc_no.
NVL (S3.updt_dt, w3.doc_dt) updt_dt.
cases where s3.bat_no = w3.bat_no then 'Y' else ' n end batch_yn.
cases where w3.txn_code is not null
and w3.doc_no is not null
and w3.doc_dt is not null
then "case 33'.
end refers_to
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn, refers_to
of case_2
where refers_to is null
) s3
left outer join
(select i3.item_code, h3.txn_code, h3.doc_no, h3.doc_dt, i3.bat_no
of w_in_table_item_3 i3
inner join
w_in_table_head_3 h3
On i3.h3_sys_id = h3.h3_sys_id
) w3
On s3.item_code = w3.item_code
)
Select item_code, bat_no, txn_code, doc_no, boe_dt, batch_yn
of case_1
where refers_to is not null
Union of all the
Select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
of case_2
where refers_to is not null
Union of all the
Select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn,
ROW_NUMBER() over (partition by item_code of updt_dt desc order) rn
from (select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
of case_31
where refers_to is not null
Union of all the
Select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
of case_32
where refers_to is not null
Union of all the
Select item_code, bat_no, txn_code, doc_no, updt_dt, batch_yn
of case_33
where refers_to is not null
)
)
where rn = 1
ITEM_CODE | BAT_NO | TXN_CODE | DOC_NO | BOE_DT | BATCH_YN |
---|---|---|---|---|---|
I1 | B1 | T1 | 1234 | JANUARY 3, 2015 | THERE |
I1 | B30 | T30 | 7890 | FEBRUARY 5, 2015 | N |
I2 | B60 | T60 | 1234 | JANUARY 3, 2015 | N |
I3 | B70 | T70 | 1234 | FEBRUARY 1, 2015 | THERE |
I4 | - | T90 | 1234 | JANUARY 5, 2015 | N |
I6 | - | T40 | 1234 | AUGUST 5, 2015 | N |
Concerning
Etbin
Maybe you are looking for
-
How can I limit the number of attempts to print a web page
I am trying to find a solution to a problem on our network.We run several kiosk machines that allow customers to print documents and web pages. However, we find that we are wasting a lot of ink because of the user frequently sending the same print jo
-
Can I save passwords saved just like I want to do a clean install of my MAC?
I want to do a clean install on my MacBook, but I have a lot of information stored on Firefox, such as accounts and passwords, bookmarks, etc. You is a way to backup all this or I write tham on a paper?
-
Tecra M4: Unknown device ACPI\TOS620A\2 & DABA3FF & 0
Hello on my Toshiba Tecra M4 installed freshley I have a peripheral onknown in Device Manager.Its device instance ID is ACPI\TOS620A\2 & DABA3FF & 0.I can't find any hint what device is missing. I installed all forms of road the download web page and
-
The iis path network not found
How to connect to my network from windows XP x 32 to a window 7 64 X from the computer of the tree, no one can conect they can see each other, but no ore file shear connection
-
Failure to restore system due to the "unknown error".
I have a HP laptop that came with Vista on it. I tried a system restore, using more than 30 days and more recent than 30 days. None of them do. I get a message saying something similar to, "the system restore cannot be completed due to unspecified er