find the previous value of the oracle table
HelloI have a stat table who got the news as login_date, user_id, etc..
For a specific user, I have a requirement based on the no the difference in days between the date of opening of the current session and the date of last.
For example, Tom connected on June 4, 2013. His previous connection was May 31. No_of_days_difference is 5 days.
How to programmatically for each user inside a block of sub pl - sql.
Appreciate your help
Thank you
KP
Hello
Here's one way:
WITH got_analytics AS
(
SELECT user_id, login_date
, LAG (login_date) OVER ( PARTITION BY user_id
ORDER BY login_date
) AS prev_login_date
, ROW_NUMBER () OVER ( PARTITION BY user_id
ORDER BY login_date DESC
) AS r_num
FROM stat
-- WHERE ... -- If you need any filtering, put it here
)
SELECT user_id, login_date
, prev_login_date
, login_date - prev_login_date AS days_difference
FROM got_analytics
WHERE r_num = 1
;
As you can see, you needn't PL/SQL to do this, but if you need to use the PL/SQL for another reason, you can do the same thing in PL/SQL.
I hope that answers your question.
Otherwise, your zip code, a little sample of data (CREATE TABLE and only relevant columns, INSERT statements) and also publish outcomes from these data.
Point where the above statement is erroneous results, and explain, using specific examples, how you get the right result of data provided in these places.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum {message identifier: = 9360002}
Tags: Database
Similar Questions
-
Insert data as XML into the Oracle Table
Hi all
I have a requirement where the data in XML format, and I need to insert into the Oracle Table. For example, I get XML data in the following format,
< results >
< row >
< BANK_ACCOUNT_ID > 10010 < / BANK_ACCOUNT_ID >
< BANK_ID > 300968 < / BANK_ID >
Vision operations < LEGAL_ENTITY > < / LEGAL_ENTITY >
< BANK_NAME > BofA < / BANK_NAME >
< BANK_ACCOUNT_NUM > 10271-17621-619 < / BANK_ACCOUNT_NUM >
< BANK_ACCOUNT_NAME > BofA-204 < / BANK_ACCOUNT_NAME >
< BRANCH_NAME > New York < / BRANCH_NAME >
USD < CURRENCY_CODE > < / CURRENCY_CODE >
< BALANCE_DATE > 2007 - 11 - 09 < / BALANCE_DATE >
< LEDGER_BALANCE > 432705900.56 < / LEDGER_BALANCE >
< / row >
< row >
< BANK_ACCOUNT_ID > 10091 < / BANK_ACCOUNT_ID >
< BANK_ID > 300984 < / BANK_ID >
Vision industries < LEGAL_ENTITY > < / LEGAL_ENTITY >
Barclay Bank < BANK_NAME > < / BANK_NAME >
< BANK_ACCOUNT_NUM > 70986798 < / BANK_ACCOUNT_NUM >
Bank Multi currency-626 < BANK_ACCOUNT_NAME > Barclays < / BANK_ACCOUNT_NAME >
Reading < BRANCH_NAME > < / BRANCH_NAME >
GBP < CURRENCY_CODE > < / CURRENCY_CODE >
< BALANCE_DATE > 2007 - 11 - 14 < / BALANCE_DATE >
< LEDGER_BALANCE > 24244085.24 < / LEDGER_BALANCE >
< / row >
< row >
< BANK_ACCOUNT_ID > 10127 < / BANK_ACCOUNT_ID >
< BANK_ID > 300968 < / BANK_ID >
< LEGAL_ENTITY > SSC U.S. 01 < / LEGAL_ENTITY >
< BANK_NAME > BofA < / BANK_NAME >
< BANK_ACCOUNT_NUM > 4898744 < / BANK_ACCOUNT_NUM >
< BANK_ACCOUNT_NAME > BofA SSC U.S. 02-7188 < / BANK_ACCOUNT_NAME >
< BRANCH_NAME > New York < / BRANCH_NAME >
USD < CURRENCY_CODE > < / CURRENCY_CODE >
< BALANCE_DATE > 2007 - 11 - 28 < / BALANCE_DATE >
< LEDGER_BALANCE > 10783815.28 < / LEDGER_BALANCE >
< / row >
< / results >
I like to write PLSQL code that will receive these data with XML tags and insert it into the Oracle Table. Is this possible with built-in XML features provided in the Oracle database?
Please Guide...
Kind regards
PriyankaBut the problem is the file XML is to have the details of the records if you carefully observed the XML file. But by using more high statement select I get output in the following format.
ORG_ID REQ_LINE PO_NUMBER EXPECTED_REC_QTY USER_NAME REQ_NUMBER
204204 1444714450 11 64446445 11 OPERATIONSOPERATIONSThe table has only one row, so you get a single row as output.
I'm surprised that you find useful examples showing how to divide the data into several lines.(1) create the table with the following option, it will optimize the performance of storage and query for large XML documents:
CREATE TABLE xxios_xml_data_test(xml_data XMLTYPE) XMLTYPE COLUMN xml_data STORE AS SECUREFILE BINARY XML ;
(2) interview table with:
SQL> select x.* 2 from xxios_xml_data_test t 3 , xmltable( 4 '/Results/Row' 5 passing t.xml_data 6 columns ORG_ID number path 'ORG_ID' 7 , REQ_NUMBER number path 'REQ_NUMBER' 8 , REQ_LINE number path 'REQ_LINE' 9 , PO_NUMBER number path 'PO_NUMBER' 10 , EXPECTED_REC_QTY number path 'EXPECTED_REC_QTY' 11 , USER_NAME varchar2(30) path 'USER_NAME' 12 ) x 13 ; ORG_ID REQ_NUMBER REQ_LINE PO_NUMBER EXPECTED_REC_QTY USER_NAME ---------- ---------- ---------- ---------- ---------------- ------------------------------ 204 14447 1 6444 1 OPERATIONS 204 14450 1 6445 1 OPERATIONS
-
ODI - read CSV file and write to the Oracle table
Hello world
After 4 years, I started to work again with ODI, and I'm completely lost.
I need help, I don't know what to use for each step, interfaces, variables, procedures...
What I have to do is the following:
(1) reading a CSV file-> I have the topologies and the model defined
(2) assess whether there is a field of this CSV file in TABLE A-> who do not exist in the table is ignored (I tried with an interface joining the csv with the TABLE model a model and recording the result in a temporary data store)
Evaluate 3) I need to update TABLE C and if not I need to INSERT if another field that CSV exists in TABLE B-> if there
Could someone help me with what use?
Thanks in advance
Hi how are you?
You must:
Create an interface with the CSV template in the source and a RDBM table in the target (I'll assume you are using Oracle). Any type of filter or the transformation must be defined to be run in the stadium. (you must use a LKM for SQL file and add an IKM Sql control (it is best to trim them and insert the data when it cames to a file if you want after this process, you may have an incremental update to maintain history or something like that).)
For validation, you will use a reference constraints in the model of the oracle table: (for this you need a CKM Oracle to check constraints)
Then, you must select the table that you sponsor and in the column, you choose which column you will match.
To article 3, you repeat the above process.
And that's all. Pretty easy. If you do not have the two tables that you need to use your validation that you need to load before loading the CSV file you need valid.
Hope this can help you
-
Query to find the biggest table in the database of the oracle ERP?
Hello
I would like to see the biggest table in Oracle ERP database, can someone give me the query?
Thank you
FatihaSelect owner, table_name from dba_tables where blocks (select max (blocks) of dba_tables);
-
On the analysis of the oracle Tables, indexes
Hi guru,.
Thanks for the previous help.
I have scenerio
I have three table which is refreshed weekely (Truncate and load).
I have to manually analyze using DBMS_STATS. GATHER_TABLE_STATS?
My knowledge is when we insert frequently so only we analyze tables and their indexes.
I'm using the Oracle version:
1 oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production
2 PL/SQL Release 11.2.0.3.0 - Production
3 "CORE 11.2.0.3.0 Production."
Thnaks,
truncation does not remove the object statistics:
-11.2.0.1.
create table t
as
Select rownum id
of the double
connect by level<=>=>
SQL > exec dbms_stats.gather_table_stats (user, 't')
PL/SQL-Prozedur been abgeschlossen.
SQL > select num_rows, last_analyzed from user_tables where table_name = 't';
NUM_ROWS LAST_ANA
---------- --------
10000 16.04.14
SQL > truncate table t;
Tabelle mit TRUNCATED geleert.
SQL > select num_rows, last_analyzed from user_tables where table_name = 't';
NUM_ROWS LAST_ANA
---------- --------
10000 16.04.14
So if your table contains almost the same data after the operation of loading/truncate old statistics may be sufficient. But it is difficult to imagine you do a TRUNCATE/loading operation to re-import data - almost certainly is a good idea to gather statistics after the operation of loading/truncate, if you have the time and resources to do this.
-
Help to download the xml of the oracle table below
Dear all,
I tried best to download the below xml to oracle table but giving the link between the tables is very difficult for me. can someone help me to import the XML below for oracle table
<? XML version = "1.0" encoding = "utf-8"? >
< Claim.Submission xmlns:tns = "http://www.haad.ae/DataDictionary/CommonTypes" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi: noNamespaceSchemaLocation = "http://www.haad.ae/DataDictionary/CommonTypes/ClaimSubmission.xsd" >
< header >
MF65 < SenderID > < / SenderID >
C014 < ReceiverID > < / ReceiverID >
< TransactionDate > 03/12/2012 10:40 < / TransactionDate >
< RecordCount > 1 < / RecordCount >
< DispositionFlag > PRODUCTION < / DispositionFlag >
< / header >
< claim >
< ID > 23112 / < ID >
< MemberID > 100000874 < / MemberID >
A022 < PayerID > < / PayerID >
MF65 < ProviderID > < / ProviderID >
< EmiratesIDNumber > 111-1111-1111111-1 < / EmiratesIDNumber >
< raw > 115 < / gross >
< PatientShare > 20 < / PatientShare >
< net > 95 < / Net >
< meeting >
MF65 < FacilityID > < / FacilityID >
< type > 1 < / Type >
< > 47685 PatientID < / PatientID >
< Start > 02/11/2012 12:00 < / Start >
< / meeting >
< Diagnostics >
Principal of < type > < / Type >
< code > < code > 461.9
< / Diagnosis >
< Diagnostics >
Secondary < type > < / Type >
< code > < code > 462
< / Diagnosis >
< activity >
23112_1 < ID > < /ID >
< Start > 02/11/2012 12:00 < / Start >
< type > 3 < / Type >
< code > < code > 99202
< quantity > 1 < / quantity >
< net > 95 < / Net >
D1310 < clinician > < / clinician >
< / activity >
< / claim >
< Claim.Submission >Pls tell me how I can get
Have you considered using the storage relational object for this?
Since you have patterns, you could record in the database, which will automatically create storage appropriate for your XML documents as well as validate at the time of insertion.
You can then create individual views to query the nested parts of the document and finally insert the data into relational tables final.See the documentation for an introduction to the concepts:
http://docs.Oracle.com/CD/E11882_01/AppDev.112/e23094/partpg2.htm#g997354You will find examples on the {forum: id = 34} forum and its FAQ: {: identifier of the thread = 410714}
-
XML document to the oracle tables - data isn't fatching
Hello
I'm new to xml and trying to extract some fields of XML to oracle to use more in the application tables. I wrote the following to extract the values, but nothing is fatching document:
<? XML version = "1.0" encoding = "UTF-8"? >
-dmsgo:DMS_GO_Interface xmlns:dmsgo = "https://globalordering.daimler.com/start/dms/interface/DMS_GO_Interface/v1" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi: schemaLocation = "https://globalordering.daimler.com/start/dms/interface/DMS_GO_Interface/v1 DMS_GO_Interface_v1.xsd" >
< dmsgo:majorversion > 1 < / dmsgo:majorversion >
< dmsgo:identity context = datetimecreated "CONFGOFR_OUT" = "03/01/2011 10:51 ' source = 'go' sourceversion ="1.410.1"/ >"
-< dmsgo:prospect >
< code dmsgo:requestresponse = "0" / >
< dmsgo:references / >
-dmsgo:configurationcontext dataversion = LangueCode "2163" = "" orderingmarket = '867' saleslevel "O" = >
< dmsgo:configurationdate > 03/01/2011 < / dmsgo:configurationdate >
< / dmsgo:configurationcontext >
-< dmsgo:vehicle >
< dmsgo: variant baumuster = "2120482" manufacturercode = "2120482" / >
< dmsgo:desc > E 200 CGI BlueEFFICIENCY sedan RHD < / dmsgo:desc >
-< dmsgo:colorcombination >
< dmsgo:interiorcolor codeowner = 'C' manufacturercode = "4201" = ppmtype "to THE" > black leather < / dmsgo:interiorcolor >
< dmsgo:exteriorcolor = 'C' manufacturercode codeowner = "2497" ppmtype "READ" = > metal Brown corrosion < / dmsgo:exteriorcolor >
< dmsgo:paintzone manufacturercode = "" preference = "2" / > "
< / dmsgo:colorcombination >
INSERT INTO p1 (flux_name, elment_1, elment_2, elment_3)
SELECT flux_name, elment_1, elment_2, elment_3
FROM XMLTable)
XMLNamespaces ('https://globalordering.daimler.com/start/dms/interface/DMS_GO_Interface/v1' as 'dmsgo'),
"dmsgo:DMS_GO_Interface/perspective/vehicle.
passage xmltype (bfilename('DMLDIR','prospect.xml'), nls_charset_id ('CHAR_CS'))
columns
path of varchar2 (20) flux_name "dmsgo:variant/@baumuster"
path of varchar2 (20) elment_1 "dmsgo:desc"
path of varchar2 (20) elment_2 ' dmsgo:colorcombination / interiorcolor',
path of varchar2 (20) elment_3 'dmsgo:colorcombination/interiorcolor/@manufacturercode '.
);
Help, please.
Looking forward to early response.
Thank you
UsmanHello
'Re missing you the prefix to namespace on elements.
This should work:SQL> SELECT flux_name, elment_1, elment_2, elment_3 2 FROM XMLTable( 3 XMLNamespaces ('https://globalordering.daimler.com/start/dms/interface/DMS_GO_Interface/v1' as "dmsgo"), 4 'dmsgo:DMS_GO_Interface/dmsgo:prospect/dmsgo:vehicle' 5 passing xmltype(bfilename('DMLDIR','prospect.xml'), nls_charset_id('CHAR_CS')) 6 columns 7 flux_name varchar2(20) path 'dmsgo:variant/@baumuster', 8 elment_1 varchar2(40) path 'dmsgo:desc', 9 elment_2 varchar2(20) path 'dmsgo:colorcombination/dmsgo:interiorcolor', 10 elment_3 varchar2(20) path 'dmsgo:colorcombination/dmsgo:interiorcolor/@manufacturercode' 11 ); FLUX_NAME ELMENT_1 ELMENT_2 ELMENT_3 -------------------- ---------------------------------------- -------------------- -------------------- 2120482 E 200 CGI BlueEFFICIENCY Sedan RHD Leather black 4201
-
Hi gurus,
I have a question, is it possible that we can follow the history of the growth of the tables. For example, table A, B, C have been created when the database is created in the schema "ricky". How we can follow the growth of tables in a report. Lets say we want to see the growth of this table, after two years, so we can refer a custom script that can report weekly or monthly in this table growth within 2 years. The reason why I ask is to plan the purge policy.
Any help would me much appreciated
SQL > select * from v version $;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
AMT for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
Published by: 821269 on March 25, 2011 16:20Hello, welcome to the forum.
>
is it possible that we can follow the history of the growth of the tables
>Automatically by Oracle, no.
Manually, do it by yourself. Yes.
You can create a table where you can store the information you want, like this (for example).
CREATE TABLE TABLES_SIZE_HIST ( SNAP_DATE DATE, SNAP_TYPE CHAR(1), --you can put D=Daily, W=Weekly etc OWNER VARCHAR2(30), SEGMENT_TYPE VARCHAR2(30), SEGMENT_NAME VARCHAR2(30), SEGMENT_BYTES NUMBER) /
Regularly lets you insert data in the table above to this statement (as an example, you can insert data into the table in many ways).
INSERT INTO TABLES_SIZE_HIST SELECT sysdate, 'W', s.owner, s.segment_type, s.segment_name, s.bytes FROM dba_segments s WHERE s.owner = '
' AND s.segment_type = ' ' AND s.segment_name IN ('
', ' ',.....,' ') /
So the above query, you can put it in a work of Oracle or in a Cron Job (unix) to say something.
After your period of 2 years, you can query the data collected and desitions.
We must be very careful because maybe you can have a lot of data in your table. So, you have to find the best scenario for storage.
Of course, depends on the time that you make to the instantaneous, daily, weekly, twice per day etc.
HTH
----------
johnxjeanXML from the Oracle Table data
Hi all
I'm new to this network. I'm also new to oracle XML package. I want a help with the query below.
CREATE TABLE EMP (ID NUMBER PRIMARY KEY, NAME VARCHAR2 (10), TELEPHONE NUMBER);
INSERT INTO EMP (ID, NAME, PHONE) VALUES (11, 'Joy', 1234);
INSERT INTO EMP (ID, NAME, PHONE) VALUES (22, 'Mike', 5678).
INSERT INTO EMP (ID, NAME, PHONE) VALUES (33, "Jason", NULL);
COMMIT;
I want to export data from the EMP table in an XML file with the format below.
Power required:
<? XML version = "1.0" encoding = "UTF-8"? > < Joy STATICDATA > < EMP > < ID > 11 < /ID > < NAME > < / NAME > < / EMP > < / STATICDATA >
<? XML version = "1.0" encoding = "UTF-8"? > < Mike STATICDATA > < EMP > < ID > 22 < /ID > < NAME > < / NAME > < / EMP > < / STATICDATA >
<? XML version = "1.0" encoding = "UTF-8"? > < Jason STATICDATA > < EMP > < ID > 33 < /ID > < NAME > < / NAME > < / EMP > < / STATICDATA >
I used some XML functions and you wrote the following query.
Select XMLROOT (XMLELEMENT (staticdata, XMLELEMENT (EMP, XMLELEMENT(ID,ID), XMLELEMENT(NAME,NAME))), version "1.0" encoding = "UTF - 8') xml EMP;
my query output:
<? XML version = "1.0" encoding = "UTF-8"? >
< STATICDATA >
< EMP >
< ID > 11 / < ID >
Joy of < NAME > < / NAME >
< / EMP >
< / STATICDATA >
<? XML version = "1.0" encoding = "UTF-8"? >
< STATICDATA >
< EMP >
< ID > 22 / < ID >
< NAME > Mike < / NAME >
< / EMP >
< / STATICDATA >
<? XML version = "1.0" encoding = "UTF-8"? >
< STATICDATA >
< EMP >
< ID > 33 / < ID >
Jason < NAME > < / NAME >
< / EMP >
< / STATICDATA >
But I want the out as the power required above. all records in a single line. can someone help me achieve the desired output. also can I export all columns of the table with something like select * from the table in the XML file?
Thank you
DelobelleDon't know why you need it on a single line, but you could:
Select XMLTYPE (REGEXP_REPLACE (XMLROOT (XMLELEMENT (staticdata, XMLELEMENT (EMP, XMLELEMENT(ID,ID), XMLELEMENT(NAME,NAME))), version "1.0" encoding = "UTF - 8'), CHR (10) |)) ' *<><'))>'))>
FROM EMP;SY.
Find the Base Table hence temporary Table is based on data
Hi all
I develop a report using Oracle reports Builder 6. The report that I develop is very similar to the seeded report "CIP détail Report", in Oracle Apps. This report uses a temporary database table 'FA_BALANCES_REPORT_GT' but I'm not be able to find the table, hence this temporary table is data drawing. I need details of the table to use in my report.
Thank you in advance.
RahulHello Rahul,
I think you should post this message on the forum of E-Business Suite. Anyway, you can consult the Oracle support note [395342.1 | https://support.oracle.com/CSP/main/article?cmd=show&type=NOT&id=395342.1] how FA_BALANCES_REPORT_GT of Table fill temporary cost report for retail (FASCOSTD)? and see if that helps you.
Kind regards.
Do not include the Oracle Tables
I am new to Oracle and need to ask a question.
Some oracle tables seem to act different than DB2.
To determine the number of records in dba_jobs is 1.
Can I describe the table and find there are about
18 columns in the table.
Then I run a SELECT * on the table.
When I select, looks like it is printing on about 8 different records.
With only the MISC ENV field being filled.
How should I interpret it
Here are the commands I entered:
Thank youSQL> select count(*) from dba_jobs; COUNT(*) ---------- 1 SQL> describe dba_jobs; Name Null? Type ----------------------------------------- -------- ---------------------------- JOB NOT NULL NUMBER LOG_USER NOT NULL VARCHAR2(30) PRIV_USER NOT NULL VARCHAR2(30) SCHEMA_USER NOT NULL VARCHAR2(30) LAST_DATE DATE LAST_SEC VARCHAR2(8) THIS_DATE DATE THIS_SEC VARCHAR2(8) NEXT_DATE NOT NULL DATE NEXT_SEC VARCHAR2(8) TOTAL_TIME NUMBER BROKEN VARCHAR2(1) INTERVAL NOT NULL VARCHAR2(200) FAILURES NUMBER WHAT VARCHAR2(4000) NLS_ENV VARCHAR2(4000) MISC_ENV RAW(32) INSTANCE NUMBER SQL> select * from dba_jobs; JOB LOG_USER PRIV_USER ---------- ------------------------------ ------------------------------ SCHEMA_USER LAST_DATE LAST_SEC THIS_DATE THIS_SEC NEXT_DATE ------------------------------ --------- -------- --------- -------- --------- NEXT_SEC TOTAL_TIME B -------- ---------- - INTERVAL -------------------------------------------------------------------------------- FAILURES ---------- WHAT -------------------------------------------------------------------------------- NLS_ENV -------------------------------------------------------------------------------- MISC_ENV INSTANCE ---------------------------------------------------------------- ---------- 1 SYSMAN SYSMAN JOB LOG_USER PRIV_USER ---------- ------------------------------ ------------------------------ SCHEMA_USER LAST_DATE LAST_SEC THIS_DATE THIS_SEC NEXT_DATE ------------------------------ --------- -------- --------- -------- --------- NEXT_SEC TOTAL_TIME B -------- ---------- - INTERVAL -------------------------------------------------------------------------------- FAILURES ---------- WHAT -------------------------------------------------------------------------------- NLS_ENV -------------------------------------------------------------------------------- MISC_ENV INSTANCE ---------------------------------------------------------------- ---------- SYSMAN 20-APR-09 22:29:55 20-APR-09 JOB LOG_USER PRIV_USER ---------- ------------------------------ ------------------------------ SCHEMA_USER LAST_DATE LAST_SEC THIS_DATE THIS_SEC NEXT_DATE ------------------------------ --------- -------- --------- -------- --------- NEXT_SEC TOTAL_TIME B -------- ---------- - INTERVAL -------------------------------------------------------------------------------- FAILURES ---------- WHAT -------------------------------------------------------------------------------- NLS_ENV -------------------------------------------------------------------------------- MISC_ENV INSTANCE ---------------------------------------------------------------- ---------- 22:30:55 17989 N JOB LOG_USER PRIV_USER ---------- ------------------------------ ------------------------------ SCHEMA_USER LAST_DATE LAST_SEC THIS_DATE THIS_SEC NEXT_DATE ------------------------------ --------- -------- --------- -------- --------- NEXT_SEC TOTAL_TIME B -------- ---------- - INTERVAL -------------------------------------------------------------------------------- FAILURES ---------- WHAT -------------------------------------------------------------------------------- NLS_ENV -------------------------------------------------------------------------------- MISC_ENV INSTANCE ---------------------------------------------------------------- ---------- sysdate + 1 / (24 * 60) JOB LOG_USER PRIV_USER ---------- ------------------------------ ------------------------------ SCHEMA_USER LAST_DATE LAST_SEC THIS_DATE THIS_SEC NEXT_DATE ------------------------------ --------- -------- --------- -------- --------- NEXT_SEC TOTAL_TIME B -------- ---------- - INTERVAL -------------------------------------------------------------------------------- FAILURES ---------- WHAT -------------------------------------------------------------------------------- NLS_ENV -------------------------------------------------------------------------------- MISC_ENV INSTANCE ---------------------------------------------------------------- ---------- 0 JOB LOG_USER PRIV_USER ---------- ------------------------------ ------------------------------ SCHEMA_USER LAST_DATE LAST_SEC THIS_DATE THIS_SEC NEXT_DATE ------------------------------ --------- -------- --------- -------- --------- NEXT_SEC TOTAL_TIME B -------- ---------- - INTERVAL -------------------------------------------------------------------------------- FAILURES ---------- WHAT -------------------------------------------------------------------------------- NLS_ENV -------------------------------------------------------------------------------- MISC_ENV INSTANCE ---------------------------------------------------------------- ---------- EMD_MAINTENANCE.EXECUTE_EM_DBMS_JOB_PROCS(); JOB LOG_USER PRIV_USER ---------- ------------------------------ ------------------------------ SCHEMA_USER LAST_DATE LAST_SEC THIS_DATE THIS_SEC NEXT_DATE ------------------------------ --------- -------- --------- -------- --------- NEXT_SEC TOTAL_TIME B -------- ---------- - INTERVAL -------------------------------------------------------------------------------- FAILURES ---------- WHAT -------------------------------------------------------------------------------- NLS_ENV -------------------------------------------------------------------------------- MISC_ENV INSTANCE ---------------------------------------------------------------- ---------- NLS_LANGUAGE='AMERICAN' NLS_TERRITORY='AMERICA' NLS_CURRENCY='$' NLS_ISO_CURRENC JOB LOG_USER PRIV_USER ---------- ------------------------------ ------------------------------ SCHEMA_USER LAST_DATE LAST_SEC THIS_DATE THIS_SEC NEXT_DATE ------------------------------ --------- -------- --------- -------- --------- NEXT_SEC TOTAL_TIME B -------- ---------- - INTERVAL -------------------------------------------------------------------------------- FAILURES ---------- WHAT -------------------------------------------------------------------------------- NLS_ENV -------------------------------------------------------------------------------- MISC_ENV INSTANCE ---------------------------------------------------------------- ---------- Y='AMERICA' NLS_NUMERIC_CHARACTERS='.,' NLS_DATE_FORMAT='DD-MON-RR' NLS_DATE_LAN JOB LOG_USER PRIV_USER ---------- ------------------------------ ------------------------------ SCHEMA_USER LAST_DATE LAST_SEC THIS_DATE THIS_SEC NEXT_DATE ------------------------------ --------- -------- --------- -------- --------- NEXT_SEC TOTAL_TIME B -------- ---------- - INTERVAL -------------------------------------------------------------------------------- FAILURES ---------- WHAT -------------------------------------------------------------------------------- NLS_ENV -------------------------------------------------------------------------------- MISC_ENV INSTANCE ---------------------------------------------------------------- ---------- GUAGE='AMERICAN' NLS_SORT='BINARY' JOB LOG_USER PRIV_USER ---------- ------------------------------ ------------------------------ SCHEMA_USER LAST_DATE LAST_SEC THIS_DATE THIS_SEC NEXT_DATE ------------------------------ --------- -------- --------- -------- --------- NEXT_SEC TOTAL_TIME B -------- ---------- - INTERVAL -------------------------------------------------------------------------------- FAILURES ---------- WHAT -------------------------------------------------------------------------------- NLS_ENV -------------------------------------------------------------------------------- MISC_ENV INSTANCE ---------------------------------------------------------------- ---------- 0102000000000000 0 JOB LOG_USER PRIV_USER ---------- ------------------------------ ------------------------------ SCHEMA_USER LAST_DATE LAST_SEC THIS_DATE THIS_SEC NEXT_DATE ------------------------------ --------- -------- --------- -------- --------- NEXT_SEC TOTAL_TIME B -------- ---------- - INTERVAL -------------------------------------------------------------------------------- FAILURES ---------- WHAT -------------------------------------------------------------------------------- NLS_ENV -------------------------------------------------------------------------------- MISC_ENV INSTANCE ---------------------------------------------------------------- ----------
Published by: user10747262 on April 21, 2009 11:56I think you see the results of the formatting in SQL * Plus when you use certain default settings. Try the following and then run your query again
set pagesize 100
The Oracle table object type - error
Hello
I created an oracle object as
[CREATE or REPLACE TYPE t_test_obj () IS OBJECT
TestId INTEGER,
testdesc VARCHAR2 (64)
);]
Then created the type from above table
[create or replace type t_table in table of the t_test_obj;]
I want to create the table containing the type above as below
create the table t_tab_test (test1 t_table); but I got the error as
ERROR on line 1:
ORA-22913: must specify the name of the table for the nested table column or attribute
---
Requirement: As my function returns this object of type table and I want to insert these values in a table where I want this. All other pointers are also useful.
Help, please.
Kind regards
Kapiland with a function
create function f_test return t_table as begin return t_table (t_test_obj (1, 'first'), t_Test_obj (2, 'seconde')); end; / insert into t_tab_test values (10, f_test);
Remove duplicates from the oracle table using 2 columns
Hello
I need to remove the duplicates of an oracle table based on 2 columns in the table.i tried to remove duplicates using the join, but get the error like sql error ora-00933
Thank you
Hello
Here's one way:
DELETE FROM table_x
WHERE ROWID NOT IN)
SELECT MIN (ROWID)
FROM table_x
Col_1, col_2
);
I hope that answers your question.
If this isn't the case, please post a small example data (CREATE TABLE and only relevant columns, INSERT statements), and the results you want from this data.
In the case of a DML operation (for example, REMOVE) the sample data should show what look like the paintings before the DML, and results will be the content of the or the tables changed after the DML.
Explain, using specific examples, how you get these results from these data.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum: Re: 2. How can I ask a question on the forums?
Querying the oracle table that has a column with the name of "FILE".
Hi all
I need to have an oracle table that has the column with the name "FILE".
I can query all columns with the query "select * from table".
But I'm not able to use the query "select the table file.
This table is converted from ms access to oracle and I need to have this column with the name "FILE".
Any suggestions?
Thank you
Abdellaoui
Hello
FILE is a keyword from Oracle, so it's not a good name,
Use FILEDATE, or DATE_FILED, or something else that is not in V$ RESERVED_WORDS. KEYWORD as the name column.
If you need to use the FILE, then you must use quotation marks.
Of XMLType to the oracle tables
HelloCould someone help me with this. I have this xml document and I need to insert tables custom fields. His return empty values or null
This is my request.--
SELECT d . *
DE d_allegro_xml_tmp xh
xmltable (' / AllocationResultDocument' )
by the way xh . xml_col
columns
DocumentIdentification VARCHAR2()64) WAY ' / AllocationResultDocument/DocumentIdentification '
) d;
Here is the XML document that is in the d_allegro_xml_tmp table
<? XML version = "1.0" encoding = "UTF-8"? >
AllocationResultDocument xsi: noNamespaceSchemaLocation=' allowance-result - document.xsd ' DtdVersion='4' DtdRelease='0' xmlns: xsi="""http://www.w9.org/2001/XMLSchema-instance""">
< DocumentIdentification v='A_R-CH-IT-D-DAILYPRODU-131107-01'/ >
< DocumentVersion v="1"/>
< DocumentType v="A25"/>
< SenderIdentification codingScheme="A01" v='10X1001A1001A57U'/ >
< SenderRole v="A07"/>
< ReceiverIdentification codingScheme="A01" v='12 X-0000001848-D'/ >
< ReceiverRole v="A29"/>
< CreationDateTime v=' 2013-11 - 06 T 07: 52:15Z '/ >
< BidTimeInterval v=' 2013-11 - 06 T 23: 00Z / 2013-11 - 07 T 23: 00Z "/ >
< Field v='10YDOM - 1001 A 0060' codingScheme="A01"/ >
< SubjectParty codingScheme="A01" v='12 X-0000001848-D'/ >
< SubjectRole v="A29"/>
< AllocationTimeSeries >
< TimeSeriesIdentification v='AllocationResults_TS_1611126'/ >
< BidDocumentIdentification v='CH-IT-D-DAILYPRODU-131107-01'/ >
< BidDocumentVersion v="3"/>
< BidIdentification v="BID00002"/>
< AuctionIdentification v='CH-IT-D-DAILYPRODU-131107-01'/ >
< BusinessType v="A03"/>
< InArea v="10YIT-GRTN-----B" codingScheme="A01"/>
< OutArea v=' 10YCH-SWISSGRIDZ ' codingScheme="A01"/ >
< ContractType v="A01"/>
< ContractIdentification v=« 0611139OEF01 »/ >
< MeasureUnitQuantity v="MAW"/>
< Currency v="EUR"/>
< MeasureUnitPrice v="MWH"/>
< Period >
< TimeInterval v=' 2013-11 - 06 T 23: 00Z / 2013-11 - 07 T 23: 00Z "/ >
< Resolution v="PT60M"/>
< Interval of >
< Point of sale v="1"/>
< Qty. v="25.0"/>
< PriceAmount v="12.29"/>
< BidQty v="25.0"/>
< BidPriceAmount v="22.92"/>
</ Interval of >
< Interval of >
< Point of sale v="2"/>
< Qty. v="25.0"/>
< PriceAmount v="10.96"/>
< BidQty v="25.0"/>
< BidPriceAmount v="20.32"/>
</ Interval of >
< Interval of >
< Point of sale v="3"/>
< Qty. v="25.0"/>
< PriceAmount v="9.97"/>
< BidQty v="25.0"/>
< BidPriceAmount v="12.29"/>
</ Interval of >
< Interval of >
< Point of sale v="4"/>
< Qty. v="0.0"/>
< PriceAmount v="10.54"/>
< BidQty v="25.0"/>
< BidPriceAmount v="10.46"/>
</ Interval of >
< Interval of >
< Point of sale v="5"/>
< Qty. v="25.0"/>
< PriceAmount v="12.39"/>
< BidQty v="25.0"/>
< BidPriceAmount v="18.53"/>
</ Interval of >
< Interval of >
< Point of sale v="6"/>
< Qty. v="25.0"/>
< PriceAmount v="14.83"/>
< BidQty v="25.0"/>
< BidPriceAmount v="29.07"/>
</ Interval of >
< Interval of >
< Point of sale v="7"/>
< Qty. v="25.0"/>
< PriceAmount v="17.0"/>
< BidQty v="25.0"/>
< BidPriceAmount v="24.54"/>
</ Interval of >
< Interval of >
< Point of sale v="8"/>
< Qty. v="25.0"/>
< PriceAmount v="11.3"/>
< BidQty v="25.0"/>
< BidPriceAmount v="15.31"/>
</ Interval of >
< Interval of >
< Point of sale v="9"/>
< Qty. v="25.0"/>
< PriceAmount v="13.7"/>
< BidQty v="25.0"/>
< BidPriceAmount v="20.16"/>
</ Interval of >
</ Period >
</ AllocationTimeSeries >
AllocationResultDocument >
The ACCESS of COLUMNS path expression is compared to the context item passed the main XQuery expression, so should not repeat the path of this element.
All values are stored in attributes ('v'), so your path should include this additional step:
SQL > SELECT d.
2 d_allegro_xml_tmp xh
3, xmltable ('/ AllocationResultDocument')
4 passage xh.xml_col
5 columns
PATH of VARCHAR2 (64) 6 DocumentIdentification 'DocumentIdentification/@v '.
7 ) d
8;
DOCUMENTIDENTIFICATION
----------------------------------------------------------------
A_R-CH-IT-D-DAILYPRODU-131107-01
Get the number of rows in the oracle table
Hi all
I want to get the total number of rows in the sql to the appmodule table.
After you apply the criteria to view some on the view object. If he try with getallrowsinrange the number of rows found within the viewobject was but I want a total number of rows in the sql table.
How can I get that
I use jdev 11.1.1.5
Thanks in advanceI threw something together, quick and dirty, don't hesitate to optimize.
Assuming you want the County table, I put the code in a subclass of EntityDefImpl since it is representing a table in the middle tier.
public class EmpDefImpl extends EntityDefImpl { /** * This is the default constructor (do not remove). */ public EmpDefImpl( ) {} //~ Methods **************************************************************************** public long getTableRowCount( DBTransaction transaction ) { String query = getQuery( ); String countQuery = String.format( "SELECT COUNT(*) FROM (%s)", query ); long count = 0; ViewObject vo = transaction.createViewObjectFromQueryStmt( countQuery ); try { vo.executeQuery( ); Row row = vo.first( ); Number number = (Number)row.getAttribute( 0 ); count = number.longValue( ); } finally { vo.remove( ); } return count; } }
Depending on your card type, you may not get an oracle.jbo.domain.Number, but something else, so the cast may need correction.
Usage example:
public class EmpEditViewImpl extends ViewObjectImpl { public EmpEditViewImpl() { } protected void executeQueryForCollection( Object object, Object[] object2, int i ) { super.executeQueryForCollection( object, object2, i ); EmpDefImpl def = ( EmpDefImpl )getEntityDef( 0 ); long tableRowCount = def.getTableRowCount( getDBTransaction() ) ); // Do something with it } }
As you can see, the code is fairly generic. Also, you might be able to put this in a base extension ADF class.
Sascha
Published by: Sascha Herrmann on June 7, 2012 14:39
Maybe you are looking for
-
I just got my rocket today, I wonder just why rocket keeps tuning in number impair.1.3.5.7.9... How can I adjust an even number for example, 107,0 105.0,... Do I need to update firmware? Thank you. Sorry for my language.
-
Unable to delete files...
Hello Recently, I am unable to delete files downloaded... This is new for my computer. I have Windows Vista Home Premium 32-bit. The problem is that when I try to delete a file a box comes up and says I need permission, which you can never ask me be
-
How much memory can I use?
Hello I have an inspiron 530 with 4 GB of memory. Can I add more memory? If so What should I ask for when shopping for memory? Thank you Teleam
-
Phone numbers of the Contacts Q10 blackBerry lost and mixed.
Today, I discovered my Q10 (recently updated OS) had "lost" my daughters phone number in my contacts and had put his number under MY name. We do not have the same name or last name that she is married. When I try to re enter my phone number, it will
-
Reverse road injection for remote VPN Clients
Hello world you will need to confirm if reverse road injection is used only for Site to site VPN? Also to say that we have two sites using site-to-site vpn Site A Site B Private private IP IP 17