Renaming column giving error
alter table tablename change oldcolumnnname to newcolumnname;
but it has given partition or subpartition keyword is missing
please suggest ..
db: oracle 11g
regards
raj
raj_fresher wrote:
alter table mytabl rename column old_col to new_col
this gives me the errorIt shouldn't, 11g too:
SQL> alter table test_tab rename column x to y;
Table altered.
Similar Messages
-
Error while renaming column in Apex 3.2.1
Hi,
I am getting the following error while renaming column in Oracle Apex 3.2.1 through SQL workshop:
"ORA-24344: success with compilation error"
Interestingly, it only gives an error when I rename the column again to its original name. For example, if I renaming the column X to X1 (no problem) but renaming back to X, I get this error. Same is true for X to X1 to X2 without any issues but renaming back from X2 to either X1 or X, I get the same error.
Any insight into this issue would be very helpful and greatly appreciated.
Thanks,
MilaanI've moved a step ahead, getting the new apex screen at http://127.0.0.1:8080/apex/ and can also login to my application. However there is no image for Application Express on http://127.0.0.1:8080/apex/ and I cannot click on the Login button. Hitting http://127.0.0.1:8080/i/ does list down the images. Any clue on what could be the problem?
For others reference: I'm not sure what was wrong, but I tried the entire steps again, with the 2 changes: shutdown the listener and job process ( in step 3.1) before running 'apexins' and second that I installed on SYSAUX and not USERS (in step 4)
1. Downloaded apex_3.2.1.zip to C:\Software
2. unzip apex_3.2.1.zip to C:\Software\apex
3. started command prompt and set these variables
set ORACLE_HOME=C:\oraclexe\app\oracle\product\10.2.0\server
set ORACLE_SID=xe
set ORACLE_PATH=C:\oraclexe\app\oracle\product\10.2.0\server\bin
set LD_LIBRARY_PATH=C:\oraclexe\app\oracle\product\10.2.0\server\lib
3.1 Shutdown the listener and job services
4.
sqlplus /nolog
CONNECT SYS as SYSDBA
@apexins SYSAUX SYSAUX TEMP /i/
5.
sqlplus /nolog
CONNECT SYS as SYSDBA
@apxchpwd
6.
Stopped and Started the Database, also the listener and job processes
7.
sqlplus /nolog
connect sys as sysdba
@apxldimg.sql c:\software
8.
sqlplus /nolog
connect sys as sysdba
exec dbms_xdb.setListenerLocalAccess (l_access => FALSE); -
JDev 10g, VO Extension is giving error
When I tried extending the seeded VO, its giving error at "Step 4 of 7". Error is "Each row in the query result columns must be mapped to a unique Query Attribute in the Mapped Entity Columns"...Even I dont modify the base query, its giving the same error. Any solution?
Thanks
RajIts JDev10g bug...VOs with transient columns will give such error. To solve, that try renaming the alias name in sql query. Eg: PeopleName => change this alias to People_Name
-
Creation of triggers using CFQUERY tag is giving error
Hi,
I am creating triggers and stored procedure on ORACLE data
base using <CFQUERY>.
<CFQUERY DATASOURCE="CRM">
create or replace trigger AWC_ACCOUNTINGPERIODSID_TRI
before insert on AWC_ACCOUNTINGPERIODS
for each row
begin
select AWC_ACCOUNTINGPERIODSID_SEQ.nextval into :new.AP_ID
from dual;
end;
</CFQUERY>
But the created trigger is not compiled, it is giving the
following error
"Line # = 1 Column # = 6 Error Text = PLS-00103: Encountered the
symbol "" when expecting one of the following: begin case declare
exit for goto if loop mod null pragma raise return select update
while with <an identifier> << close current delete
fetch lock insert open rollback savepoint set sql execute commit
forall merge pipe The symbol "" was ignored."
If I edit that trigger in enterprise manager console by
pressing space and compile that, it is working fine with out any
error. If i run the above statement in sql *plus, It is working
fine with out any error. Can you please tell me why this is
happening if i run it using cfquery tag and also the possible
solutions.
Thanks in advance,
VinodI can't tell you why your particular trigger is failing, but
here is some "typical" reasons from Oracle's metalink.
Common reasons for PLS-00103
Error Summary
PLS-00103 Encountered the symbol "%s" when expecting one of
the following (Oerr
LS.103)
Error Details
~~~~~~~~~~~~~
Error: PLS-00103
Text: Encountered the symbol "%s" when expecting one of the
following:
Cause: This error message is from the parser. It found a
token
(language element) that is inappropriate in this context.
Action: Check previous tokens as well as the one given in the
error message. The line and column numbers given in the
error
message refer to the end of the faulty language construct.
PLS-00103 errors can often be difficult to localize what the
error is so here are some
common reasons for PLS-00103 errors..
A very common reason for PLS-00103 is when a reserved word is
used, with a reserved word
means words that names an oracle object or a built in
procedure, for example MOD, ABS,
TABLE, VIEW etc..
When trying to use SQL*PLUS commands in PL/SQL procedures,
like SPOOL, SET and other
commands that belongs to SQL*PLUS can result in this error.
Using parameter declaration at the IN/OUT clause in a
procedure, this works in versions
prior to 8.0.4, but it just ignored the declaration.
Using DDL commands in PL/SQL will fail in PLS-00103, the way
to use DDL commands is
to build a procedure in dynamic sql.
When creating package specification and a package body, a
PLS-00103 error will occur
if there is no slash, '/', after the package specification.
Phil -
DATAEXPORT to sql server is giving error
Hi,
I am using DATAEXPORT to export data to SQL tables but its giving error:
MY TABLE:
USE SBC;
Create table TEST
Period nchar(20),
HSP_Rates nchar(20),
Years nchar(10),
Currency nchar(5),
Scenario nchar(20),
ICP nchar(20),
[Co.] nchar(20),
Version nchar(20),
Product nchar(20),
Entity nchar(30),
Account nchar(50),
Data numeric(18, 5)
Created this order based on export taken on file
**My Script:**
SET DATAEXPORTOPTIONS
DataExportLevel "ALL";
DATAEXPORTCOLFORMAT ON;
DataExportOverwriteFile ON;
DataExportDecimal 4;
DATAEXPORTCOND ("HSP_InputValue" <> #MISSING And "HSP_InputValue" <> 0);
FIX (@REMOVE(@RELATIVE ("Balance_Sheet",0),"CY_Earnings"),"Per7","HSP_InputValue","FY12","Local","MY12 Budget", @RELATIVE ("ICP Top",0),@RELATIVE ("Co Total",0),Working,@RELATIVE (PODS,0),@RELATIVE ("Entity",0));
/*DATAEXPORT "File" "," "D:\Test.txt"*/
DATAEXPORT "DSN" "TEST" "Test" "admin" "XXXXXX";
ENDFIX;
Output when exported to File:
"Per7"
"HSP_InputValue","FY12","Local","MY12 Budget","No IC","Co 100","Working","ALLEZ","100-1050","Subs_Cash",500000.046
"HSP_InputValue","FY12","Local","MY12 Budget","No IC","Co 100","Working","AirFreight","100-1050","Subs_Cash",534324.370
ERROR IN LOGS:
[Fri Feb 03 01:10:20 2012]Local/SBC///15796/Info(1013210)
User [admin@Native Directory] set active on database [SBC]
[Fri Feb 03 01:10:20 2012]Local/SBC/SBC/admin@Native Directory/2208/Info(1013091)
Received Command [Calculate] from user [admin@Native Directory]
[Fri Feb 03 01:10:20 2012]Local/SBC/SBC/admin@Native Directory/2208/Info(1013167)
Received Command [Calculate] from user [admin@Native Directory] using [Test.csc]
[Fri Feb 03 01:10:20 2012]Local/SBC/SBC/admin@Native Directory/2208/Info(1021004)
Connection String is generated
[Fri Feb 03 01:10:20 2012]Local/SBC/SBC/admin@Native Directory/2208/Info(1021041)
Connection String is [DSN=SBC;UID=...;PWD=...;]
[Fri Feb 03 01:10:20 2012]Local/SBC/SBC/admin@Native Directory/2208/Info(1021000)
Connection With SQL Database Server is Established
[Fri Feb 03 01:10:20 2012]Local/SBC/SBC/admin@Native Directory/2208/Info(1021013)
ODBC Layer Error: [21S01] ==> [[Microsoft][ODBC SQL Server Driver][SQL Server]Column name or number of supplied values does not match table definition.]
[Fri Feb 03 01:10:20 2012]Local/SBC/SBC/admin@Native Directory/2208/Info(1021014)
ODBC Layer Error: Native Error code [213]
[Fri Feb 03 01:10:20 2012]Local/SBC/SBC/admin@Native Directory/2208/Error(1012085)
Unable to export data to SQL table [Test]. Check the Essbase server log and the system console to determine the cause of the problem.
[Fri Feb 03 01:10:20 2012]Local/SBC/SBC/admin@Native Directory/2208/Info(1021002)
SQL Connection is Freed
[Fri Feb 03 01:10:20 2012]Local/SBC/SBC/admin@Native Directory/2208/Warning(1080014)
Transaction [ 0xb0006( 0x4f2b885c.0xd4e40 ) ] aborted due to status [1012085].
[Fri Feb 03 01:10:20 2012]Local/SBC/SBC/admin@Native Directory/2208/Info(1012579)
Total Calc Elapsed Time for [Test.csc] : [0.022] seconds
I have tried using SQL Drivers for ODBC connection as well as Wire protocol driver.
Please assist asap.
Regards,
VinitChawla,
Fixed in 9.3.3, Check out this, their are few more bugs fixed related to DataExport.
http://docs.oracle.com/cd/E10530_01/doc/epm.931/esb_93300_readme.pdf
8404516 Calculator.The DATAEXPORTCOND calculation command clashes with the FIX
command.
8913164 Calculator. Data exports that use DATAEXPORTCOND do not always export all
the data expected because not all conditions are taken into account within the
DATAEXPORTCOND statement
8988310 Calculator. When exporting data using the DATAEXPORT command from a
duplicate outline that contains a shared hierarchy, the exported data contains the
shared member, not the prototype Etc..
Cheers...!!
Rahul S. -
Crystal Reports XI: Invalid column name error
Hello!
I have a crystal report using a SQL command that is getting the following error (occasionally):
Failed to retrieve data from the database.
Details: ADO Error Code: 0x80040e14
Source: Microsoft OLE DB Provider for SQL Server
Description: Invalid column name 'IPCSKUGroup'.
SQL State: 42S22
Native Error: 207 [Database Vendor Code: 207]
I say occasionally because if i go to Database>> Log on or Log off server and log off the target server and then rerun the report, it will work. If i refresh the report with different parameters, i get the error.
I'm running Crystal Reports XI version 11.0.0.1282 on Windows XP SP2 32-bit. The data is in a SQL Server 2000 database.
This is the portion of the query causing the problem:
(drop/clear temp tables and initiallize a few variables with parameters)
(...other queries putting together the temp table #WorkingTotals) - This part works fine because the report runs if i remove the following portion.
select wtt.QtrMax,QuarterName,Year,wtt.IPCSKUGroup as IPCSKUNum,ServicePriceSuggested,PcsBilled,BilledRevenue,PriceIndex,StdRevenue,
(select sum(TT.BilledRevenue) from
(select Top 4 wt2.BilledRevenue
from #WorkingTotals2 wt2
where wt2.IPCSKUGroup = wtt.IPCSKUGroup and wt2.QtrMax <= wtt.QtrMax order by wt2.QtrMax desc)as TT)
as M12Revenue
from #WorkingTotals wtt
The entire query works fine when I run it in SQL Query Analyzer. But Crystal has an issue with the way i'm figuring the M12Revenue field. The M12Revenue is a moving 12 month revenue which is the sum of the revenue for the past 4 quarters for each quarter.
This is what i've tried thus far:
Putting the entire query into a stored procedure
Storing what gets stored in #WorkingTotals into a database table rather than a temp one
Renaming columns to various different things.
Each of those still resulted in the error.
Thanks for the help!!!
WesHi Wes,
What does SQL Profiler show you when the error happens?
Try using ODBC to see if it also errors, may be an issue in MS's MDAC and the OLE DB driver. MS usually updates MDAC with all Patches but you may want to verify you are using the latest version.
Thank you
Don -
Can we rename column in Oracle 9i?
Thanks,
AlexI don't think it should be that complicated unless you have any contraints to it. Do you have any foreign keys that are referencing to this particular table ? Also let me know what syntax are you using for dropping the column ?
Also look at the following example, try these things on some test/dummt table first.
Dropping a Column: Example
===========================
This statement illustrates the drop_column_clause with CASCADE CONSTRAINTS. Assume table t1 is created as follows:
CREATE TABLE t1 (
pk NUMBER PRIMARY KEY,
fk NUMBER,
c1 NUMBER,
c2 NUMBER,
CONSTRAINT ri FOREIGN KEY (fk) REFERENCES t1,
CONSTRAINT ck1 CHECK (pk > 0 and c1 > 0),
CONSTRAINT ck2 CHECK (c2 > 0)
An error will be returned for the following statements:
/* The next two statements return errors:
ALTER TABLE t1 DROP (pk); -- pk is a parent key
ALTER TABLE t1 DROP (c1); -- c1 is referenced by multicolumn
-- constraint ck1
Submitting the following statement drops column pk, the primary key constraint, the foreign key constraint, ri, and the check constraint, ck1:
ALTER TABLE t1 DROP (pk) CASCADE CONSTRAINTS;
If all columns referenced by the constraints defined on the dropped columns are also dropped, then CASCADE CONSTRAINTS is not required. For example, assuming that no other referential constraints from other tables refer to column pk, then it is valid to submit the following statement without the CASCADE CONSTRAINTS clause:
ALTER TABLE t1 DROP (pk, fk, c1);
Shalu -
I have tried in vain to rename a column in 8i. There are no good examples out there. Here's my code
SQL> DESC KKQA_CLINIC_CD
Name Null? Type
CLINIC_CD NOT NULL VARCHAR2(15)
REC_EFFENDDT NOT NULL DATE
REC_EFFDT NOT NULL DATE
IDX_NM VARCHAR2(60)
DEPT VARCHAR2(30)
SUBDEPT VARCHAR2(30)
CLINIC_CD_DESC VARCHAR2(150)
MIM_CODES_CLINIC VARCHAR2(1)
HOSPITAL_BASED VARCHAR2(15)
REG_SOURCE VARCHAR2(15)
SQL> ALTER TABLE KKQA_CLINIC_CD ADD (CLINIC_CD_EFFENDDT DATE);
Table altered.
SQL> UPDATE KKQA_CLINIC_CD SET CLINIC_CD_EFFENDDT=REC_EFFENDDT;
0 rows updated.
A second attempt to rename another col, yeilds error:
ALTER TABLE KKQA_CLINIC_CD SET CLINIC_CD_EFFDT=REC_EFFDT
ERROR at line 1:
ORA-02000: missing UNUSED keyword
I just can't seem to find any meaningful examples or substance on this problem particularly ora-02000
I have tried the "unused" keyword example, it basically deletes a col. Can someone help, I am thoroughly puzzled.Hi
Renaming a column is not supported in 8i.
Chris
PS: the syntax is "ALTER TABLE <table name> RENAME COLUMN <old column name> TO <new column name>" -
This is my update query in oracle but it is giving error:
Update (select NM.Nominal_Amount,NM.Number_of_Units,NM.Current_Spot,NM.Published_Spot,NM.Strike_Price
from note_master NM ,
( select NORM.Note_Master_ID, NORM.Asset, NORM.Currency , 50 as Spot_Price_Calc, NVL(TOADD.NA,0) As NA, NVL(TOADD.NS,0)
As NS, NVL(TOADD.NA_P,0) As NA_P, NVL(TOADD.NS_P,0) As NS_P, NVL(TOADD.SA,0) As SA, (50 * (NORM.Strike_Price_Per/100)) as
rike_Price_Calc, (Case When UPPER(NORM.Misc2) = 'Q' THEN (NORM.No_Of_Shares * 50 * (NORM.Strike_Price_Per/100)) Else
NORM.Nominal_Amount End )as Nominal_Amount_Calc, (Case When UPPER(NORM.Misc2) ='N' THEN (NORM.Nominal_Amount /( 50 * (NORM.Strike_Price_Per/100)))
Else NORM.No_Of_Shares End )as NO_Of_Shares_Calc, (Case When UPPER(NORM.Misc2) = 'Q' THEN (NORM.No_Of_Shares * 50 * (NORM.Strike_Price_Per/100) * NORM.Issue_Price )/100
Else (NORM.Nominal_Amount * NORM.Issue_Price )/100 End )as Settlement_Amt_Calc from ( select Note_Master_Id, MIN(Spot_Price) as Spot_Price, Min(Strike_Price) as
Strike_Price, SUM(Nominal_Amount) as Nominal_Amount, SUM(No_Of_Shares) as No_Of_Shares , MIN(Issue_Price) as Issue_Price, MIN(Asset) as Asset, MIN(Currency) as Currency,
MIN(Strike_Price_Per) as Strike_Price_Per, MIN(Misc2) as Misc2 from ( Select Note_Master_Id, Spot_Price, Strike_Price, Nominal_Amount, No_Of_Shares, Issue_Price, Asset,
Currency , Strike_Price_Per,Misc2 from Sample_ADF_FinIQ_Common.Note_Order_RM Where Order_Status_Flag = 'YYYYYYNNNNNNNNNN' And RO_ID = 'R000000002' ) NORM Group by Note_Master_Id ) NORM
Left Outer JOIN Sample_ADF_FinIQ_Common.RATESSPOTBIDASK RSBA On RSBA.PairCode = (NORM.Asset ) Left Outer JOIN ( select Note_Master_ID,sum(Nominal_Amount)
as NA, sum(No_Of_Shares) as NS, sum(NominalAmt_Pending) as NA_P, sum(NoOfShares_Pending) as NS_P,sum(Settlement_Amt) as SA from Note_Order_RM
Where RO_ID <> 'R000000002' group by Note_Master_ID ) TOADD On TOADD.Note_Master_ID = NORM.Note_Master_ID ) RESULT1 where NM.Note_Master_ID = RESULT1.Note_Master_ID )
set Price_Updated_YN = 'Y' ,
Nominal_Amount = RESULT1.NA + RESULT1.Nominal_Amount_Calc , Number_Of_Units = RESULT1.NS + RESULT1.NO_Of_Shares_Calc ,
Current_Spot = RESULT1.Spot_Price_Calc , Published_Spot = RESULT1.Spot_Price_Calc , Strike_Price = RESULT1.Strike_Price_Calc
where NM.Note_Master_ID = RESULT1.Note_Master_ID;
error :
rror at Command Line:17 Column:105
Error report:
SQL Error: ORA-00904: "RESULT1"."STRIKE_PRICE_CALC": invalid identifier
00904. 00000 - "%s: invalid identifier"
can anybody help.
ThanksStill one more typo problem exists in you sql stament , equal to(=) operator is missing in your original statement look below
original
Where RO_ID 'R000000002' group by Note_Master_ID ) TOADD On TOADD.Note_Master_ID = NORM.Note_Master_ID ) RESULT1 where NM.Note_Master_ID = RESULT1.Note_Master_ID )
set Price_Updated_YN = 'Y'
modified
Where RO_ID='R000000002' group by Note_Master_ID ) TOADD On TOADD.Note_Master_ID = NORM.Note_Master_ID ) RESULT1 where NM.Note_Master_ID = RESULT1.Note_Master_ID )
set Price_Updated_YN = 'Y' Ok, once try with this code, some syntax prob i modified it.
Update (select NM.Nominal_Amount,NM.Number_of_Units,NM.Current_Spot,NM.Published_Spot,NM.Strike_Price
from note_master NM ,
( select NORM.Note_Master_ID, NORM.Asset, NORM.Currency , 50 as Spot_Price_Calc, NVL(TOADD.NA,0) As NA, NVL(TOADD.NS,0)
As NS, NVL(TOADD.NA_P,0) As NA_P, NVL(TOADD.NS_P,0) As NS_P, NVL(TOADD.SA,0) As SA, (50 * (NORM.Strike_Price_Per/100)) as
Strike_Price_Calc, (Case When UPPER(NORM.Misc2) = 'Q' THEN (NORM.No_Of_Shares * 50 * (NORM.Strike_Price_Per/100)) Else
NORM.Nominal_Amount End )as Nominal_Amount_Calc, (Case When UPPER(NORM.Misc2) ='N' THEN (NORM.Nominal_Amount /( 50 * (NORM.Strike_Price_Per/100)))
Else NORM.No_Of_Shares End )as NO_Of_Shares_Calc, (Case When UPPER(NORM.Misc2) = 'Q' THEN (NORM.No_Of_Shares * 50 * (NORM.Strike_Price_Per/100) * NORM.Issue_Price )/100
Else (NORM.Nominal_Amount * NORM.Issue_Price )/100 End )as Settlement_Amt_Calc from ( select Note_Master_Id, MIN(Spot_Price) as Spot_Price, Min(Strike_Price) as
Strike_Price, SUM(Nominal_Amount) as Nominal_Amount, SUM(No_Of_Shares) as No_Of_Shares , MIN(Issue_Price) as Issue_Price, MIN(Asset) as Asset, MIN(Currency) as Currency,
MIN(Strike_Price_Per) as Strike_Price_Per, MIN(Misc2) as Misc2 from ( Select Note_Master_Id, Spot_Price, Strike_Price, Nominal_Amount, No_Of_Shares, Issue_Price, Asset,
Currency , Strike_Price_Per,Misc2 from Sample_ADF_FinIQ_Common.Note_Order_RM Where Order_Status_Flag = 'YYYYYYNNNNNNNNNN' And RO_ID = 'R000000002' ) NORM Group by Note_Master_Id ) NORM
Left Outer JOIN Sample_ADF_FinIQ_Common.RATESSPOTBIDASK RSBA On RSBA.PairCode = (NORM.Asset ) Left Outer JOIN ( select Note_Master_ID,sum(Nominal_Amount)
as NA, sum(No_Of_Shares) as NS, sum(NominalAmt_Pending) as NA_P, sum(NoOfShares_Pending) as NS_P,sum(Settlement_Amt) as SA from Note_Order_RM
Where RO_ID 'R000000002' group by Note_Master_ID ) TOADD On TOADD.Note_Master_ID = NORM.Note_Master_ID ) RESULT1 where NM.Note_Master_ID = RESULT1.Note_Master_ID )
set Price_Updated_YN = 'Y' ,
Nominal_Amount = RESULT1.NA + RESULT1.Nominal_Amount_Calc , Number_Of_Units = RESULT1.NS + RESULT1.NO_Of_Shares_Calc ,
Current_Spot = RESULT1.Spot_Price_Calc , Published_Spot = RESULT1.Spot_Price_Calc , Strike_Price = RESULT1.Strike_Price_Calc
where NM.Note_Master_ID = RESULT1.Note_Master_ID;Edited by: darkStargate on Dec 8, 2011 7:42 PM -
Renaming columns resulting in breakage of already existing reports
Hi
We recently upgraded from 10g to 11g and we faced the following issue related to trailing spaces:
In 10g we had trailing spaces for few columns which accounts for say around 300 in number. After consistency check, these trailing spaces were shown as warnings in 10g and did not error out any reports. But in 11g, these trailing spaces were shown as errors and resulting in the breakage of already existing reports. To avoid this, we have to delete the trailing spaces along with the aliases. After this, the only process we are aware of, is to re-pull the renamed columns in the existing reports to make them error free. Now we have around 200 reports using these columns and it requires good amount of manual effort to go in. I would like to know, is there any better solution other than re-pulling these columns to keep the reports error free.
Any suggestions on this will be very helpful and greatly appreciated.
ThanksHi,
Refer
renaming presentation colums
Re: renaming using rename wizard.
Re: Renaming Business Model and Subject Area
Thanks
Deva
Edited by: Devarasu on Sep 27, 2011 5:27 PM -
Rename columns in Presentaion Layer
Hi,
I need to change the column names in the Presentaion Layer. I need only the beginning of the word to be uppercase. Do I have to go to BMM layer and use the rename wizard and get all the columns again to presentation layer. We have a lot of columns so manually doing it would be very time consuming. I am trying to do in Presenation Layer itself using Rename wizard but somehow the 'next' field is not highlighted to go to the next step. Any suggestions? Also if I change any column name in presentation layer manually do I also have to chnage the name in BMM layer as well.Hi,
Keeping the column names consistent in BMM and presntation layer is best suggested as diffrent names in both the layers can lead to confusion .As Aliastair suggested if you rename in presentation layer then it will create aliases to Old names,If someone delete that alias then you will get view display error in report.So follow a simple approach and keep names consistent in both the layesr unless and until its very urgent to rename columns in presentation layer.
Thanks
Sandeep
Edited by: Sandeep Saini on 23-Jul-2010 08:34 -
Here is a stored proc we use to rename columns. It's not bulletproof, but it will get you started:
create or replace procedure &&1.RenameColumn(uid IN varchar2,tablename IN varchar2,oldcolumn IN varchar2,newcolumn IN varchar2)
as
dt varchar2(106);
dl number;
dp number;
ds number;
nulls varchar2(1);
dd long;
buildstring varchar2(128);
alteraddstring varchar2(256);
alterdropstring varchar2(256);
updatestring varchar2(128);
begin
SELECT data_type,data_length,data_precision,data_scale,nullable,data_default
INTO dt,dl,dp,ds,nulls,dd
FROM all_tab_columns
WHERE UPPER(owner)=UPPER(uid) and UPPER(table_name)=UPPER(tablename)
and UPPER(column_name)=UPPER(oldcolumn);
CASE
WHEN dt='CHAR'
THEN
IF dl IS NOT NULL THEN
buildstring:=dt||' '||'('||dl||')';
ELSE
buildstring:=dt;
END IF;
WHEN dt='DATE'
THEN
buildstring:=dt;
WHEN substr(dt,1,9)='TIMESTAMP'
THEN
buildstring:=dt;
WHEN dt='VARCHAR'
THEN
IF dl IS NOT NULL THEN
buildstring:=dt||' '||'('||dl||')';
ELSE
buildstring:=dt;
END IF;
WHEN dt='VARCHAR2'
THEN
IF dl IS NOT NULL THEN
buildstring:=dt||' '||'('||dl||')';
ELSE
buildstring:=dt;
END IF;
WHEN dt='NUMBER'
THEN
buildstring:=dt;
IF dp IS NOT NULL THEN
buildstring:=buildstring||' '||'('||dp;
IF ds IS NOT NULL THEN
buildstring:=buildstring||','||ds;
END IF;
buildstring:=buildstring||')';
END IF;
END CASE;
IF nulls = 'N' THEN
buildstring:=buildstring||' NOT NULL';
END IF;
IF dd is not null THEN
IF dt='NUMBER' THEN
buildstring:=buildstring||' DEFAULT '||dd;
ELSE
buildstring:=buildstring||' DEFAULT '''||dd||'''';
END IF;
END IF;
dbms_output.put_line('String: ' || buildstring);
alteraddstring:='alter table '||tablename||' add ('||newcolumn||' '||buildstring||')';
dbms_output.put_line('AlterAddString: ' || alteraddstring);
updatestring:='update '||tablename||' set '||newcolumn||'='||oldcolumn||'';
dbms_output.put_line('UpdateString: ' || updatestring);
alterdropstring:='alter table '||tablename||' drop column '||oldcolumn||'';
dbms_output.put_line('DropString: ' || alterdropstring);
EXECUTE IMMEDIATE alteraddstring;
EXECUTE IMMEDIATE updatestring;
EXECUTE IMMEDIATE alterdropstring;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('ERROR executing renamecolumn'||SUBSTR(SQLERRM, 1, 100));
rollback;
end;Hi
Renaming a column is not supported in 8i.
Chris
PS: the syntax is "ALTER TABLE <table name> RENAME COLUMN <old column name> TO <new column name>" -
Making field input editable after giving error msg from table event 01
Hi All,
I have a requirement of giving error msg and making that row or the particular field input editable by writing code in table event 01 i.e before saving any record in a z-table i have to chk some condition for a column value and if that condition fails then i have to give error msg and make that column input editable.
I have created a routine for event 01 and written the code to give error msg. But my problem is that column is not becoming input editable. Could you pls tell me how can i make that field editable?
Thanks in advance.Hi Piyali,
Use SET PARAMETER & GET PARAMETER ID .
You will get it.
Best Regards,
Pravin -
Item Open Interface giving error for Org Assignment
We ran the MTL_SYSTEMS_ITEMS_INTERFACE & loaded all the items at master level.
We are having issues in setting at Org level. Cant figure out what the issue as only few records gets assigned & then garbage sets in for remaining records. An SR has been raised & the tech support representative was saying that UOM's are different at master & org levels. Never heard of this issue earlier. I have worked with UOM's different at Master/Org levels.
The UOM's are different at Master & Org Level and in some cases the UOM are different for different Orgs. Attribute Control for Primary/Sec UOM is at Org level. The UOM's belong to the same UOM Class. There are standard conversions defined for all these UOMs.
Any pointers for quick resolution ?Pl do not post duplicates - Item Open Interface giving error for Org Assignment
-
I am getting this error since purchasing my latest book:
“This page contains the following errors: error on line 1 at column 1: error on line 1 at column 1: Encoding error
Below is a rendering of the page up to the first error”
This message also appears on some, but not all books I purchased earlier.
I've tried to restart my iPhone (5) and downloaded iBooks (and the books itself) again several times but nothing has changed. I’m also synced the iPhone via iTunes without luck.
It’s the latest version of iBooks from Appstore. The same books on iBooks for iPad and Mac working fine!
iOS 7.0.6
iBooks 3.2 (2083)Did you Reset your iphone?
Maybe you are looking for
-
recently changed my PC and successfully exported my itunes library. My problem is that when I now try to buy a song I get a message saying that there was a problem downloading (song) and that the network connection could not be made. Occasionally I g
-
I can't get my projects in Final Cut Pro X to work in 1080p. One turned out to be 1080p by "accident" but I did everything the same as the ones that did not. Same camera/settings (shot in 60i). I didn't really care cause I had to get some stuff done
-
I have to select pictures in bridge and I want to check the sharpness of each picture. However, this is not possible because almost every picture that I click, opened directly in Photoshop or Camera Raw. And that is not the intention! How do I get ri
-
Voice loss also with signal OK
Hi, I have an environment with WISM release 6.0 and 7921 with firmware 1.3.2. This is the issue that I have, when the signal from the AP on the phone display is around 2 step ( 5 step is full signal) the call remains active but the conversation becom
-
FDFToolkit appendSaves merge AppendSaves FDF to different document
Hello, I use the FDFToolkit to receive submitted FDF content w/ incremental changes from a browser PDF. I then use the toolkit to extract the appendedSaves (FDFExtractAppendSaves) and then later merge this data to a fresh copy of the PDF. This works