Formattin a varchar2(240) column
hi,
I need help with formatting a column varchar2(240) where it contains data like the following:
+1. OSP FIBER ACCESSORY-CLOSURE-FIBER-48 F-CAPITAL-NONE-NONE+
+2. OSP PVC-PVC PIPE-NONE-50 M.M-CAPITAL-NONE-NONE+
+3. OSP PVC ACCESSORY-BEND PIPE-BEND PIPE 90 DGREE-100 M.M-CAPITAL-NONE-NONE+
+4. Work manship+
I need to format the column in a select statement in such a way that it excludes the the last three -CAPITAL-NONE-NONE when the column contains them.
The table is from oracle inventory:
APPS.PO_LINES
Any idea?
Jonathan Jacobson wrote:
ascheffer wrote:
rtrim isn't the right choice for this:Given OP's opening message, I disagree with your statement.I agree with ascheffer, and also think that you need to go back and refresh your understanding of how R/LTRIM works, as I don't think you've understood it properly.
Ie. your RTRIM solution and a more concise RTRIM solution both give the same wrong answer, whereas the regexp_substr gives the correct answer:
with t as (select 'FIBER-48 DICPITAL-CAPITAL-NONE-NONE' str from dual union all
select 'FIBER-48 DICPITAL-SUNDRY-NONE-NONE' str from dual union all
select 'CAP-I-LAP-TAP-CAPITAL-NONE-NONE' str from dual
select str,
RTRIM(str,'-CAPITAL-NONE-NONE') new_str,
RTRIM(str,'-CAPITLNOE') new_str2,
regexp_replace(str,'-[[:alpha:]]*-NONE-NONE$') new_str3
from t;
STR NEW_STR NEW_STR2 NEW_STR3
FIBER-48 DICPITAL-CAPITAL-NONE-NONE FIBER-48 D FIBER-48 D FIBER-48 DICPITAL
FIBER-48 DICPITAL-SUNDRY-NONE-NONE FIBER-48 DICPITAL-SUNDRY FIBER-48 DICPITAL-SUNDRY FIBER-48 DICPITAL
CAP-I-LAP-TAP-CAPITAL-NONE-NONE CAP-I-LAP-TAP
Similar Messages
-
Execute immediate of Anonymous pl/sql block stored in a VARCHAR2 DB Column
Hi Guys,
I really hope someone can help me with this.
I have the following pl/sql anonymous block stored in a varchar2 database column.
declare
l_my_val varchar2(32767);
cursor c_activity is
SELECT
l.DESCRIPTION || decode(l2.DESCRIPTION,null,'',l2.description, '-' || l2.description) || decode(a.DT,'Y',' - Distributed Training','N',null,null) as value1
FROM ACTIVITY a
,MOUNTAINEERING m
,LOV l
,LOV l2
WHERE a.JSATFA_ID = 82
AND a.SPECIFIC_ACTIVITY_LOV_ID = l.LOV_ID
AND m.ACTIVITY_ID(+) = a.ACTIVITY_ID
AND m.CLASSIFICATION_LOV_ID = l2.LOV_ID(+);
begin
for each_row in c_activity loop
l_my_val := l_my_val || ', ' || each_row.value1;
end loop;
:l_value := ltrim (l_my_val, ', ');
end; The code is select out of the database and assigned to a local variable within my pl/sql package. The following code should demonstrate what I'm trying to achieve:
declare
l_sql varchar2(32767);
l_value varchar2(32767);
begin
select query_sql into l_sql from lov where lov_id = 100;
execute immediate l_sql using out :l_value;
dbms_output.put_line(l_value);
end;However Oracle (10.2.0.2) seems to be doing something funny with the single quotes. and gives the following error:
ORA-06550: line 1, column 1:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin case declare exit for function goto if loop mod null
package pragma procedure raise return select separate type
update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
form table call close current define delete fetch lock insert
open rollback savepoint set sql execute commit forall merge
library OPERATOR_ pipe
errorIf I embed the code I'm trying to execute within the package i.e
declare
l_sql varchar2(32767);
l_value varchar2(32767);
begin
l_sql := q'~declare
l_my_val varchar2(32767);
cursor c_activity is
SELECT
l.DESCRIPTION || decode(l2.DESCRIPTION,null,'',l2.description, '-' || l2.description) || decode(a.DT,'Y',' - Distributed Training','N',null,null) as value1
FROM ACTIVITY a
,MOUNTAINEERING m
,LOV l
,LOV l2
WHERE a.JSATFA_ID = 82
AND a.SPECIFIC_ACTIVITY_LOV_ID = l.LOV_ID
AND m.ACTIVITY_ID(+) = a.ACTIVITY_ID
AND m.CLASSIFICATION_LOV_ID = l2.LOV_ID(+);
begin
for each_row in c_activity loop
l_my_val := l_my_val || ', ' || each_row.value1;
end loop;
:l_value := ltrim (l_my_val, ', ');
end;
~';
execute immediate l_sql using out :l_value;
dbms_output.put_line(l_value);
end;It works perfectly. Notice I have used the q syntax when embedding the sql directly into the package.
I have tried
- appending the q syntax directly to query_sql stored in the database
- escaping the quotes i.e. ' become ''
Neither method seem to work. We are running 10.2.0.2 on Windows Server 2003. If anyone has any suggestions I would love to hear from you as this has me stumped.
Regards
Kris
- http://kristianjones.blogspot.comIf you do:
declare
l_sql varchar2(32767);
l_value varchar2(32767);
begin
select query_sql into l_sql from lov where lov_id = 100;
dbms_output.put_line(l_sql);
end;
You'll see something like that:
SELECT
l.DESCRIPTION || decode(l2.DESCRIPTION,null,'',l2.description, '-' || l2.description) || decode(a.DT,'Y',' - Distributed Training','N',null,null) as value1
FROM ACTIVITY a
,MOUNTAINEERING m
,LOV l
,LOV l2
WHERE a.JSATFA_ID = 82
AND a.SPECIFIC_ACTIVITY_LOV_ID = l.LOV_ID
AND m.ACTIVITY_ID(+) = a.ACTIVITY_ID
AND m.CLASSIFICATION_LOV_ID = l2.LOV_ID(+);
you need to duplicate the '
you can do many things like:
CTH@> select * from sqls;
C
select first_name || ' ' || last_name as value1 from employees where rownum=1
1 fila seleccionada.
CTH@>
CTH@> ;
1 declare
2 l_sql varchar2(32767);
3 l_value varchar2(32767);
4 type generic_cursor is ref cursor;
5
6 c generic_cursor;
7
8 begin
9 select replace(c, ''', ''''') into l_sql from sqls;
10
11 execute immediate l_sql into l_value;
12 dbms_output.put_line(l_value);
13* end;
CTH@> /
Ellen Abel
Procedimiento PL/SQL terminado correctamente.
CTH@> -
Updating a varchar2(1) column
hi,
i need to update load_status_cd, a varchar2(1) column with ' 0 ' based on a condition as below..
Which of the following way is the right choice to use?
UPDATE master_adrs_rate_center_xref a
SET a.load_status_cd =
SELECT 0 FROM master_address b
WHERE
a.mast_pri_address_id = b.mast_pri_address_id
AND a.row_modify_dt < b.last_update_date
UPDATE master_adrs_rate_center_xref a
SET a.load_status_cd = '0'
where exists(
SELECT 1 FROM
master_address b
WHERE
a.mast_pri_address_id = b.mast_pri_address_id
AND a.row_modify_dt < b.last_update_date);Second is the correct query.
First query will update wrong. It will update 0 for the records where your join condition is met and for the remaining records it will update NULL which will be totally wrong. With the introduction of where clause, your first query would be perfect
UPDATE master_adrs_rate_center_xref a
SET a.load_status_cd =
SELECT 0 FROM master_address b
WHERE
a.mast_pri_address_id = b.mast_pri_address_id
AND a.row_modify_dt < b.last_update_date
where exists
SELECT 0 FROM master_address b
WHERE
a.mast_pri_address_id = b.mast_pri_address_id
AND a.row_modify_dt < b.last_update_date
) -
Advice on creating VARCHAR2(4000) columns
Hi there
I've a question regarding table(s) design. Following is a table, which has about 10,000 rows.
As you can see there are two VARCHAR2(2000) columns.
All rows have these columns with data which are always "full" (avglength = 2000).
CREATE TABLE L_PROC
NUM NUMBER(9) NOT NULL,
TEC VARCHAR2(10 BYTE) NOT NULL,
ATE DATE NOT NULL,
PRO NUMBER(4) NOT NULL,
NPR NUMBER(7) NOT NULL,
DOC NUMBER(2) DEFAULT 0 NOT NULL,
COC NUMBER(2) DEFAULT 0 NOT NULL,
FOC NUMBER(2) DEFAULT 0 NOT NULL,
SIT CHAR(1 BYTE) NOT NULL,
EST CHAR(1 BYTE) DEFAULT 'A' NOT NULL,
DEN DATE NOT NULL,
SOL NUMBER(9) NOT NULL,
LOC VARCHAR2(80 BYTE),
CEE NUMBER(3),
CTE VARCHAR2(10 BYTE),
DEC NUMBER(2) DEFAULT null,
DIA VARCHAR2(2000 BYTE),
RES VARCHAR2(2000 BYTE),
OUT VARCHAR2(80 BYTE),
NTS VARCHAR2(80 BYTE),
ETS VARCHAR2(40 BYTE),
DAL TIMESTAMP(6) NOT NULL
When record is created in table, DIA is always filled. Then RES will be updated later.
Now end-users ask for modification which consists in alter these two column to VARCHAR2(4000).
I'm thinking on create these two columns in a separated table (perhaps using blob or clob), but I'd like to have some advice on this.
I'm a bit worried about chained rows.
Can you help me on this ? What solution do you think is better ?
Thank you in advance.
Best Regards,
HelenaReplying to Maurice questions:
do you mostly access your table via index or full table scan?
mostly via index
how many rows do you access when you execute a select against this table?
using users criteria the first step is to perform a select count(*) using that criteria; table data is displayed to the user if the result of count(*) is <= 100 rows
how often do you query the RES and DIA columns?
never queried, but always displayed; that means never used in WHERE clauses
how often are inserts and updates executed against this table?
about 100/day inserts and the same number of updates (which are performed by another user later)
which is you DB block size?
16 KB
which is the average sizes of the columns RES and DIA?
1900 (will probably increase +1000 chars)
do you have currently any kind of performance bottleneck (IO/CPU)?
not yet...
Helena -
Display checkbox for VARCHAR2(1) column
Hi, I'm getting all of my stupid questions out this week...
I have a table with a VARCHAR2(1) column that I restrict to 'Y' or NULL to make a boolean/flag column.
How do I get JDeveloper/ADF to treat this as a boolean column and display a checkbox?
In Oracle Designer you could flag the field as boolean and the value 'Y' as checked. Not sure how to do this in JDeveloper.Gordon,
All stupid questions are welcome if they are properly specified ;)
In your case Create an EO/VO. Attach it to a AM. A Data Control will be created. YOu can then use the attribute in your page and dispaly it as a selectBooleanCheckBox.
Google for how to create EO/VO/AM and Data Control. -
Compare a varchar2 segment column with a date column
Dear All ,
i have a segment column with datatype varchar2 with data sample like '2013/06/09 00:00:00' , i want to compare this column with date column
i tried many ways of conversion but not working like
select to_date(TO_NCHAR(substr('2013/06/09 00:00:00',1,11),'DD-MM-YY'))DATE_C from dual ---> giving invalid number
select TO_TIMESTAMP(TO_NCHAR(substr('2013/06/09 00:00:00',1,11),'DD-MM-YY'))DATE_C from dual ---> giving invalid number
can i have any suggestion for that please
thanks & best regardsHi,
Have you tried:
SELECT TO_DATE(SUBSTR('2013/06/09 00:00:00',1,10),'YYYY/MM/DD') DATE_C FROM dual
Octavio -
Range check for numeric values in varchar2 type column
SQL oracle 10g windows XP
I have a table which has column of type varchar2 e.g
create table osa_gms_mailbox(reg_address varchar2(60),bin_address varchar2(60));
let us insert some sample rows:
insert into osa_gms_mailbox values ('8000','8000');
insert into osa_gms_mailbox values ('9000','9000');
insert into osa_gms_mailbox values ('[email protected]','[email protected]');
If i try to run the query :
select reg_address from (
select reg_address from osa_gms_mailbox
MINUS
select reg_address from osa_gms_mailbox where
regexp_like(reg_address,'^[a-z]+|[A-Z]+$')) temp
where to_number(temp.reg_address) between 1000 and 10000;
or
select reg_address from (
select reg_address from osa_gms_mailbox
MINUS
select reg_address from osa_gms_mailbox where
regexp_like(reg_address,'^[a-z]+|[A-Z]+$'))
where to_number(reg_address) between 1000 and 10000;
it gives ORA-01722: invalid number .
how can i get the numeric comparision done for varchar2 field and exclude the rows which have atleast one alphabet (a-z,A-Z)
ThanksHi
Please check this sample , it may useful to you
/*Creating a Table*/
Create Table CHECKVARCHAR( CheckValue Varchar2(20) );
/* Inserting values in to the column with numbers and Strings */
Insert into CHECKVARCHAR Values ( 1000 );
Insert into CHECKVARCHAR values ( 2000 );
Insert into CHCEKVARCHAR values ( 10000 );
Insert into CHECKVARCHAR values ( 'Abc' );
Insert into CHECKVARCHAR values ( 'zyx' );
/*Here is the Query to avoid Invalid Number */
Select * from
( Select CheckValue
from Checkvarchar
where Ascii( Substr( CheckValue,1,1 ) ) not between 65 and 122 )
where CheckValue between 1000 and 10000; -
How to insert bytes in varchar2 column
existed data:
ALIAS VARCHAR2(240)
SELECT ALIAS,DUMP(ALIAS,8) FROM AR_COLLECTORS WHERE COLLECTOR_ID=47880
¿¿¿ Typ=1 Len=9: 351,231,263,345,230,211,350,217,261
How to create the same data from SQL PL/SQL?
INSERT INTO AR_COLLECTORS (ALIAS) VALUES ( ???I'm not quite sure what you are asking here. DUMP is a function that shows the internal representation of the data stored in a field or variable. You do not need to store the DUMP values explicitly, they are derived from your actual data. If, for some inexplicable reason, you want to store the output of the DUMP command in another table, then you can do something like
CREATE TABLE dumpvals (real_value VARCHAR2(400), dump_value VARCHAR2(4000));
INSERT INTO dumpvals
SELECT column,DUMP(column,8)
FROM table;
or, in PL/SQL
BEGIN
FOR r in (SELECT column tval,DUMP(column,8) dval
FROM table) LOOP
INSERT INTO dumpvals
VALUES(r.tval,r.dval);
END LOOP;
END;If you can give a fuller explanation of what you are looking for, perhaps someone could give a better answer.
TTFN
John -
Range Partitioning on Varchar2 column???
We hava table and it has a date column and its type is varchar2.
This column's format is '16021013' ('ddmmyyyy').
We want to make range partition on this column. What will be the best way?
do you think virtal column partitioning will be efficient?>
I'm not a new DBA:-) You can be sure. I asked only about range partitioning trick with varchar2 column because we did our examination about this table. We will need to archive this table quarter by quarter to the other archive database. Then, off course, nearly all queries are coming firstly by using this date column and they can have different filtering inside "where" conditions. Already, this table has index on this column but with huge number of data, index performance is not enough for us. This is a 7x24 banking system and we are lately joined to this project. Because of this, we cant change everything like changing data type of that column after this moment.
>
You are taking things way too personally. No one said anything about whether you were, or were not, a DBA or made any other comments about your skill or abilities.
What we ask was for you to tell us WHAT the problem was that you were trying to solve and WHY you thought partitioning would solve it.
And now, after several generic posts, you have finally provided that information. We can only comment based on the information that you post. We can't guess as to what types of queries you use or what kinds of predicates you use in those queries. But we need to know that information in order to provide the best advice.
Next time you post put the important information in your original question:
1. A table column is VARCHAR2 but contains a date value. We are unable to change the datatype of this column.
2. We need to archive data quarterly based on this date value
3. Nearly all queries use this date value and then also may have additional filter conditions
4. This date column is indexed but we would like to improve the performance beyond what this index can give us.
The above is a summary that includes all important information that is needed to know how best to help you.
And I made a pretty good guess since two replies ago I provided you with example code that shows just how to partition the table.
>
Now, our only aim is how to make range partitioning this varchar2 date column.
>
As I showed you in my example code earlier you can add a virtual column to the table and partition on it. My example code creates a monthly partitioned table that allows you to archive by month or archive every three months to archive by quarter.
You can modify that example to use quarterly partitions if you want but I would recommend that you use standard monthly partitions since they will satisfy the widest range of predicates. -
Get only strings from Varchar2 Column
Hi,
How can I extract only strings form varchar2 type column?
I have data like below.
25-Abc xy
233-xyz jj
x23A
9-dd
5-aaa(pp)
I need following outputs (- also be removed)
Abc xy
xyz jj
xA
dd
aaa(pp)
Thanks,
SujnanMaybe...
API> WITH t AS (SELECT '25-Abc xy' AS col FROM DUAL
2 UNION
3 SELECT '233-xyz jj' FROM DUAL
4 UNION
5 SELECT 'x23A' FROM DUAL
6 UNION
7 SELECT '9-dd' FROM DUAL
8 UNION
9 SELECT '5-aaa(pp)' FROM DUAL)
10 SELECT TRANSLATE(col, '1234567890-', ' ') AS RES
11 FROM t;
RES
xyz jj
Abc xy
aaa(pp)
dd
xA
Transcurrido: 00:00:00.93 -
How to truncate the text in a table column
Hi all,
I have a text column in a table RN. the column length is varchar2(240). When the text is too long I want to only display 20 text and followed by '...'
So I change the xmlfile of tableRN maximumLength="240" columns="80"
but the text is still long and let the page very wide. I notice the standard page have this functionality while I don't find any control either in the xml file or in the CO class.
Can anyone show me the method to implement this? I really don't want to modify the VO to decode the column to contain '...'
Thanks & Regards,
Scott
Edited by: Typhoon on Aug 5, 2009 1:07 PM
Edited by: Typhoon on Aug 5, 2009 1:25 PMI have resolve it, by adding these code in VOimpl.java
super.executeQuery();
oracle.jbo.RowSetIterator rowsetiterator = OIEUtil.getNoValIterator(this);
Object obj = null;
TrackExpenseReportsVORowImpl trackexpensereportsvorowimpl;
for(; rowsetiterator.hasNext(); trackexpensereportsvorowimpl.setPurpose(OIEUtil.trimString(trackexpensereportsvorowimpl.getPurpose())))
trackexpensereportsvorowimpl = (TrackExpenseReportsVORowImpl)rowsetiterator.next();
---------------------------------------------------------------OIEUtil.class-----------------------------------------------------------------------------------------
public static RowSetIterator getNoValIterator(ViewObject viewobject)
RowSetIterator rowsetiterator = viewobject.findRowSetIterator("noValidationIterator");
if(rowsetiterator == null)
rowsetiterator = viewobject.createRowSetIterator("noValidationIterator");
rowsetiterator.setRangeSize(-1);
rowsetiterator.setRowValidation(false);
rowsetiterator.reset();
return rowsetiterator;
public static String trimString(String s)
if(s == null)
return s;
if(s.length() < 20)
return s;
else
return s.substring(0, 20) + "...";
} -
Mail needs to be sent after updating the salary column of emp table
Hi,
we have table test_emp_table, oracle form based application is running on this table...
it conatins salary column, we have requirement that, when every any update to the salary column, a mail needs to be sent to concerned person with new and old salary values..
I did that using the following procedure...
===========
-- Create Temporary Table to hold the Updated values
create table email_parameters
( id number primary key,
oldsal varchar2(10),
newsal varchar2(10),
ename varchar2(100));
--- Create Procedure
CREATE OR REPLACE PROCEDURE send_email_new (
l_job IN NUMBER ) is
l_oldsal varchar2(100);
l_newsal varchar2(100);
l_emp_name varchar2(100);
l_message varchar2(100);
BEGIN
SELECT oldsal
INTO l_oldsal
FROM email_parameters
WHERE ID = l_job;
SELECT newsal
INTO l_newsal
FROM email_parameters
WHERE ID = l_job;
SELECT ename
INTO l_emp_name
FROM email_parameters
WHERE ID = l_job;
l_message:=
'Employee Name= '
|| l_emp_name
|| chr(10)||chr(10)
|| 'Old Salary= '
|| l_oldsal
|| chr(10)||chr(10)
|| 'New Salary= '
|| l_newsal;
send_mail(l_message);
DELETE FROM email_parameters
WHERE ID = l_job;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line (DBMS_UTILITY.format_error_stack);
DBMS_OUTPUT.put_line (DBMS_UTILITY.format_call_stack);
END;
--- Create Trigger
create or replace trigger send_email_trg
after update on TEST_EMP_TABLE
for each row
declare
l_job number;
begin
dbms_job.submit (job => l_job,
what => 'send_email_new(job);' );
insert into email_parameters
values (l_job, :old.sal,:new.sal,:new.ename);
end send_email_trg;
-- Create Procedure for Sending Mail
create or replace procedure send_mail(l_message varchar2) is
c utl_smtp.connection;
PROCEDURE send_header(name VARCHAR2, header VARCHAR2) AS
BEGIN
utl_smtp.write_data(c,name ||':'|| header || UTL_TCP.CRLF);
END;
BEGIN
c := utl_smtp.open_connection('192.168.0.18');
utl_smtp.helo(c, 'abc.com');
utl_smtp.mail(c, '[email protected]');
utl_smtp.rcpt(c, '[email protected]');
utl_smtp.open_data(c);
send_header('From', '[email protected]');
send_header('To', '[email protected]');
send_header('Subject', 'Warning: Employee Solary has been updated!');
utl_smtp.write_data(c, UTL_TCP.CRLF || l_message);
utl_smtp.close_data(c);
utl_smtp.quit(c);
EXCEPTION
WHEN utl_smtp.transient_error OR utl_smtp.permanent_error THEN
BEGIN
utl_smtp.quit(c);
EXCEPTION
WHEN utl_smtp.transient_error
OR utl_smtp.permanent_error THEN
NULL;
END;
raise_application_error(-20000, SQLERRM);
END;
====================
But I have doubt, if there is any problem with mail server, if user is updating salary column from form based application at same time....
will table trigger allows him to save the new record or not????? or will he get any errors????thanks justin...
I have written that code..but it works...problem is ...i am not able to understand the flow...what happens in the order, until mail is sent...
i have another code.....
I have written with out dbms_job, i have witten directly in the trigger itself...
Tom suggested the procedure, what i have given above..but not the below procedure....
I am not able to understand, what is the difference between them.....
CREATE OR REPLACE TRIGGER test_emp_table_trg
AFTER UPDATE
ON test_emp_table
FOR EACH ROW
WHEN (NEW.sal <> OLD.sal)
DECLARE
l_employee_name VARCHAR2 (240);
l_old_sal VARCHAR2 (240);
l_new_sal VARCHAR2 (240);
l_message VARCHAR2 (240);
BEGIN
/* Gets the employee full name */
BEGIN
SELECT ename
INTO l_employee_name
FROM test_emp_table
WHERE empno = :OLD.empno;
EXCEPTION
WHEN OTHERS
THEN
l_employee_name := NULL;
END;
/* Gets the old Salary */
BEGIN
SELECT sal
INTO l_old_sal
FROM test_emp_table
WHERE empno = :OLD.empno;
EXCEPTION
WHEN OTHERS
THEN
l_old_sal := 0;
END;
/* Gets the new position name */
BEGIN
SELECT sal
INTO l_new_sal
FROM test_emp_table
WHERE empno= :NEW.empno;
EXCEPTION
WHEN OTHERS
THEN
l_new_sal := 0;
END;
l_message:=
'Employee Name= '
|| l_employee_name
|| 'Old Salary= '
|| l_old_sal
|| 'New Salary= '
|| l_new_sal;
BEGIN
send_mail (l_message);
END;
==========
can you please describe it clearly???
thanks in advance my dear friend????
Edited by: oraDBA2 on Oct 4, 2008 10:26 PM -
Check which table has no column with specific name over number of tables
Hello,
Withing my schema I have 66 tables, all of them have column last_update_date. Though not all have the column program_update_date. The problem is I want to go through all the tables and know which tables does not have the program_update_date column. It is to be noted that if the table does not have the program_update_date column query 2 will be used instead of query 1.
query1:
select last_extract_date,
to_char(min(greatest(nvl(*last_update_date*,'01-Jan-10'),nvl(*program_update_date*,'01-Jan-10'))),'DD-MON-YY HH24:MI:SS') mi,
to_char(max(greatest(nvl(*last_update_date*,'01-Jan-10'),nvl(*program_update_date*,'01-Jan-10'))),'DD-MON-YY HH24:MI:SS') ma
from table_names
group by last_extract_date
order by last_extract_date desc;
query2:
select last_extract_date,
to_char(min(nvl(last_update_date,'01-Jan-10')),'DD-MON-YY HH24:MI:SS') mi,
to_char(max(nvl(last_update_date,'01-Jan-10')),'DD-MON-YY HH24:MI:SS') ma
from mispa_events
group by last_extract_date
order by last_extract_date desc ;
Please find the PLSQL code that should be used:
Declare
cursor C_1 is
select unique table_name from user_tables; table_names varchar2(240); Begin Open C_1; Loop Fetch C_1 into table_names; EXIT WHEN C_1%NOTFOUND;
EXECUTE IMMEDIATE('select last_extract_date,
to_char(min(greatest(nvl(last_update_date,''01-Jan-10''),nvl(program_update_date,''01-Jan-10''))),''DD-MON-YY HH24:MI:SS'') mi,
to_char(max(greatest(nvl(last_update_date,''01-Jan-10''),nvl(program_update_date,''01-Jan-10''))),''DD-MON-YY HH24:MI:SS'') ma
from ' || table_names ||'
group by last_extract_date
order by last_extract_date desc');
End Loop;
Close C_1;
COMMIT;
End;
Please help.
Thanks in advance.
Edited by: P.Sam on Jun 14, 2010 5:00 PMwhy not use user_tab_columns
SQL> desc user_tab_columns
Name Null? Type
TABLE_NAME NOT NULL VARCHAR2(30)
COLUMN_NAME NOT NULL VARCHAR2(30)
DATA_TYPE VARCHAR2(106)
DATA_TYPE_MOD VARCHAR2(3)
DATA_TYPE_OWNER VARCHAR2(30)
DATA_LENGTH NOT NULL NUMBER
DATA_PRECISION NUMBER
DATA_SCALE NUMBER
NULLABLE VARCHAR2(1)
COLUMN_ID NUMBER
DEFAULT_LENGTH NUMBER
DATA_DEFAULT LONG
NUM_DISTINCT NUMBER
LOW_VALUE RAW(32)
HIGH_VALUE RAW(32)
DENSITY NUMBER
NUM_NULLS NUMBER
NUM_BUCKETS NUMBER
LAST_ANALYZED DATE
SAMPLE_SIZE NUMBER
CHARACTER_SET_NAME VARCHAR2(44)
CHAR_COL_DECL_LENGTH NUMBER
GLOBAL_STATS VARCHAR2(3)
USER_STATS VARCHAR2(3)
AVG_COL_LEN NUMBER
CHAR_LENGTH NUMBER
CHAR_USED VARCHAR2(1)
V80_FMT_IMAGE VARCHAR2(3)
DATA_UPGRADED VARCHAR2(3)
HISTOGRAM VARCHAR2(15) -
Support_db column not there in fnd_nodes table
Hi
today I have did clone of 11.5.9 instance and face the below issue.
Updating s_tnsmode to 'generateTNS'
UpdateContext exited with status: 0
AC-50480: Internal error occurred: java.lang.Exception: Error while generating l
istener.ora.
Error generating tnsnames.ora from the database, temperory tnsnames.ora will be
generated using templates
Instantiating Tools tnsnames.ora
Tools tnsnames.ora instantiated
Web tnsnames.ora instantiated
adgentns.pl exiting with status 2
ERRORCODE = 2 ERRORCODE_END
.end std out.
but as per below I have solved the issue
Sqlplus apps/...
SQL> EXEC FND_CONC_CLONE.SETUP_CLEAN;
COMMIT;
EXIT;
Run AutoConfig on all tiers, firstly on the DB tier and then the APPS tiers, to repopulate the required system tables.
But I have observed there is no support_db column in fnd_nodes table, is it normal behaviour in 11.5.9?
Plz share your ideas
Thanks
ShaikHi
there is no column in fnd_nodes table. it is a single node instance. we don't have latest autoconfig patches in the current environment.
SQL> desc fnd_nodes;
Name Null? Type
NODE_NAME NOT NULL VARCHAR2(30)
LAST_UPDATE_DATE NOT NULL DATE
LAST_UPDATED_BY NOT NULL NUMBER(15)
CREATION_DATE NOT NULL DATE
CREATED_BY NOT NULL NUMBER(15)
LAST_UPDATE_LOGIN NOT NULL NUMBER(15)
PLATFORM_CODE NOT NULL VARCHAR2(30)
DESCRIPTION VARCHAR2(240)
BASEPATH VARCHAR2(20)
SUPPORT_CP VARCHAR2(1)
SUPPORT_FORMS VARCHAR2(1)
SUPPORT_WEB VARCHAR2(1)
SUPPORT_ADMIN VARCHAR2(1)
STATUS VARCHAR2(1)
PING_RESPONSE VARCHAR2(2000)
LAST_MONITORED_TIME DATE
NODE_MODE VARCHAR2(1)
NODE_ID NUMBER
SERVER_ID VARCHAR2(64)
SERVER_ADDRESS VARCHAR2(30)
HOST VARCHAR2(256)
DOMAIN VARCHAR2(256)
WEBHOST VARCHAR2(256)
Thanks
Shaik -
Copy from column to another column in same table
Hi,
Working on EBS Version : 11.5.10.2
Table Name : ASO_QUOTE_HEADERS_ALL
COLUMNS :
QUOTE_STATUS_ID NUMBER
ATTRIBUTE6 VARCHAR2(240 BYTE);
Need to copy from quote_status_id to attribute6 for that quote_header_id
example if quote_status_id = 10 then it should copy in attribute6 = 10 for quote_header_id = 69312
again if changed to quote_status_id = 10077 then it should replace with attribute6 = 10077
for quote_header_id = 69312
i wrote a procedure posted below:
CREATE OR REPLACE procedure SLC_STATUS_CAPTURE (p_quote_header_id IN number) is
BEGIN
UPDATE aso_quote_headers_all SET attribute6 = quote_status_id
WHERE quote_header_id = p_quote_header_id;
end SLC_STATUS_CAPTURE;
then calling this trigger through table level
BEGIN
SLC_STATUS_CAPTURE(:OLD.QUOTE_HEADER_ID);
END;
it is giving an error.
Please i need some help.
Thanks and Regards
VijayJohn Spencer wrote:
As others have mentioned, you cannot change column values in a statement level trigger. Also, you cannot
update the table that the trigger is firing on. If I understand correctly, you want to copy the value of
quote_status_id into attribute6 whenever a row is inserted or updated. If that is correct, then you only need a simple trigger like:
create trigger trigg
before insert or update of aso_quote_headers_all
for each row
begin
:new.attribute6 = :new.quote_status_id;
end;Thought why anybody would want to do this is beyond me - you already have the info
in your attribute6 column - what's the point in simply copying it to another column in
the same table?
Paul...
John
Maybe you are looking for
-
After updating software on my Apple TV it is asking to connect to iTunes. Can't understand why?
-
ICal and server upgrade Help please.
Hi folks, I am running 10.5.2 server on a dual G4 tower and in particular iCal, which has been running very well. I want to upgrade to a new iMac, and so far I have been unable to figure out how to successfully recreate all accounts (only 7) and re-u
-
Both Firefox & Thunderbird won't reopen after closing. require reboot
When I close Firefox or Thunderbird, they do not reopen later. Dialog box says they are still running, but process won't close in task manager. System requires reboot to get back in
-
Accessing Mobile Me settings from within aperture
Once a mobile me gallery is created, how do you change the settings? For example, changing the group that has access to it or whether users can post images or comments? I have tried right-clicking on the gallery, but nothing useful there. Also, I hav
-
User is not receiving the latest magazine after renewing subscription
Hi, A user on one of our DPS apps renewed their annual subscription on the 6th of June. However they have been unable to download the July edition of the magazine. I have advised them to uninstall and re-install the App and then Restore All Purchases