How to Copy a Long Column in PL/SQL
Hello. Can anyone tell me how to copy a table that contains a long column? I am using Oracle 8.0.5 SQL Worksheet
with the following code that generates an ORA-06502: PL/SQL: numeric or value error.
CREATE TABLE "Tmp_CB_REPORT"
CB_RPT_ID NUMBER(38, 0),
CB_ID NUMBER(38, 0),
CB_REGION_ID NUMBER(38, 0),
WHEN_PULLED DATE NOT NULL,
PARSED NUMBER(1, 0) DEFAULT (0) NOT NULL,
RAW_DATA LONG NOT NULL,
JOINT NUMBER(1, 0) DEFAULT (0) NOT NULL,
RPTTYPE NUMBER(38, 0) NOT NULL,
OPTION1 NUMBER(1, 0) DEFAULT (0) NOT NULL,
OPTION2 NUMBER(1, 0) DEFAULT (0) NOT NULL,
OPTION3 NUMBER(1, 0) DEFAULT (0) NOT NULL,
OPTION4 NUMBER(1, 0) DEFAULT (0) NOT NULL,
OPTION5 NUMBER(1, 0) DEFAULT (0) NOT NULL,
OPTION6 NUMBER(1, 0) DEFAULT (0) NOT NULL,
OPTION7 NUMBER(1, 0) DEFAULT (0) NOT NULL,
OPTION8 NUMBER(1, 0) DEFAULT (0) NOT NULL,
OPTION9 NUMBER(1, 0) DEFAULT (0) NOT NULL,
OPTION10 NUMBER(1, 0) DEFAULT (0) NOT NULL,
OPTION11 NUMBER(1, 0) DEFAULT (0) NOT NULL,
OPTION12 NUMBER(1, 0) DEFAULT (0) NOT NULL,
OPTION13 NUMBER(1, 0) DEFAULT (0) NOT NULL,
OPTION14 NUMBER(1, 0) DEFAULT (0) NOT NULL,
OPTION15 NUMBER(1, 0) DEFAULT (0) NOT NULL,
OPTION16 NUMBER(1, 0) DEFAULT (0) NOT NULL,
OPTION17 NUMBER(1, 0) DEFAULT (0) NOT NULL,
OPTION18 NUMBER(1, 0) DEFAULT (0) NOT NULL,
OPTION19 NUMBER(1, 0) DEFAULT (0) NOT NULL,
OPTION20 NUMBER(1, 0) DEFAULT (0) NOT NULL,
REGION_ID NUMBER(38, 0),
RPT_TYPE_DESC VARCHAR2(40)
LOCK TABLE CB_REPORT IN EXCLUSIVE MODE NOWAIT;
DECLARE
CURSOR datacursor IS SELECT CB_RPT_ID, CB_ID, CB_REGION_ID, WHEN_PULLED, PARSED, RAW_DATA, JOINT, RPTTYPE, OPTION1, OPTION2, OPTION3, OPTION4, OPTION5, OPTION6, OPTION7, OPTION8, OPTION9, OPTION10, OPTION11, OPTION12, OPTION13, OPTION14, OPTION15, OPTION16, OPTION17, OPTION18, OPTION19, OPTION20, REGION_ID, RPT_TYPE_DESC FROM CB_REPORT;
datarecord datacursor%ROWTYPE;
BEGIN
OPEN datacursor;
LOOP
FETCH datacursor INTO datarecord;
EXIT WHEN (datacursor%NOTFOUND);
INSERT INTO "Tmp_CB_REPORT"(CB_RPT_ID, CB_ID, CB_REGION_ID, WHEN_PULLED, PARSED, RAW_DATA, JOINT, RPTTYPE, OPTION1, OPTION2, OPTION3, OPTION4, OPTION5, OPTION6, OPTION7, OPTION8, OPTION9, OPTION10, OPTION11, OPTION12, OPTION13, OPTION14, OPTION15, OPTION16, OPTION17, OPTION18, OPTION19, OPTION20, REGION_ID, RPT_TYPE_DESC) VALUES (datarecord.CB_RPT_ID, datarecord.CB_ID, datarecord.CB_REGION_ID, datarecord.WHEN_PULLED, datarecord.PARSED, datarecord.RAW_DATA, datarecord.JOINT, datarecord.RPTTYPE, datarecord.OPTION1, datarecord.OPTION2, datarecord.OPTION3, datarecord.OPTION4, datarecord.OPTION5, datarecord.OPTION6, datarecord.OPTION7, datarecord.OPTION8, datarecord.OPTION9, datarecord.OPTION10, datarecord.OPTION11, datarecord.OPTION12, datarecord.OPTION13, datarecord.OPTION14, datarecord.OPTION15, datarecord.OPTION16, datarecord.OPTION17, datarecord.OPTION18, datarecord.OPTION19, datarecord.OPTION20, datarecord.REGION_ID, datarecord.RPT_TYPE_DESC);
END LOOP;
END;
The copy works fine if I remove the long column from the CREATE TABLE "Tmp_CB_REPORT" statement
and the cursor copy statement. Any help is appreciated.
What I think you should do is to turn your long into a LOB. LOBs are much malleable than LONGs. I suggest you have a look at the documentation for DBMS_LOB. You can create a function using DBMS_LOB that uses a temporary CLOB to reas your long column an dreturn a CLOB.
Cheers, APC
Similar Messages
-
How can find out LONG column database?
Hi,
in my database ORA-1461 error occured
01461, 00000, "can bind a LONG value only for insert into a LONG column
how can find out LONG column in my database ?DESCRIBE
The description for tables, views, types and synonyms contains the following information:
each column's name
whether or not null values are allowed (NULL or NOT NULL) for each column
datatype of columns, for example, CHAR, DATE, LONG, LONGRAW, NUMBER, RAW, ROWID, VARCHAR2 (VARCHAR), or XMLType
precision of columns (and scale, if any, for a numeric column)
Extract of the link;
http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/ch12019.htm#SQPUG040
Secondly with reference to the error;
Do not try to insert LONG datatypes into other types of columns.
Hope this helps.
Adith -
How to export data with column headers in sql server 2008 with bcp command?
Hi all,
I want know "how to export data with column headers in sql server 2008 with bcp command", I know how to import data with import and export wizard. when i
am trying to import data with bcp command data has been copied but column names are not came.
I am using the below query:-
EXEC master..xp_cmdshell
'BCP "SELECT * FROM [tempdb].[dbo].[VBAS_ErrorLog] " QUERYOUT "D:\Temp\SQLServer.log" -c -t , -T -S SERVER-A'
Thanks,
SAAD.Hi All,
I have done as per your suggestion but here i have face the below problem, in print statment it give correct query, in EXEC ( EXEC master..xp_cmdshell @BCPCMD) it was displayed error message like below
DECLARE @BCPCMD
nvarchar(4000)
DECLARE @BCPCMD1
nvarchar(4000)
DECLARE @BCPCMD2
nvarchar(4000)
DECLARE @SQLEXPRESS
varchar(50)
DECLARE @filepath
nvarchar(150),@SQLServer
varchar(50)
SET @filepath
= N'"D:\Temp\LDH_SQLErrorlog_'+CAST(YEAR(GETDATE())
as varchar(4))
+RIGHT('00'+CAST(MONTH(GETDATE())
as varchar(2)),2)
+RIGHT('00'+CAST(DAY(GETDATE())
as varchar(2)),2)+'.log" '
Set @SQLServer
=(SELECT
@@SERVERNAME)
SELECT @BCPCMD1
= '''BCP "SELECT
* FROM [tempdb].[dbo].[wErrorLog] " QUERYOUT '
SELECT @BCPCMD2
= '-c -t , -T -S '
+ @SQLServer +
SET @BCPCMD
= @BCPCMD1+ @filepath
+ @BCPCMD2
Print @BCPCMD
-- Print out below
'BCP "SELECT
* FROM [tempdb].[dbo].[wErrorLog] " QUERYOUT "D:\Temp\LDH_SQLErrorlog_20130313.log" -c -t , -T -S servername'
EXEC
master..xp_cmdshell
@BCPCMD
''BCP' is not recognized as an internal or external command,
operable program or batch file.
NULL
if i copy the print ourt put like below and excecute the CMD it was working fine, could you please suggest me what is the problem in above query.
EXEC
master..xp_cmdshell
'BCP "SELECT * FROM
[tempdb].[dbo].[wErrorLog] " QUERYOUT "D:\Temp\LDH_SQLErrorlog_20130313.log" -c -t , -T -S servername '
Thanks, SAAD. -
How to show Primary_key in Column Tab - Oracle SQL Developer 2.1.1.64
How to show Primary_key in Column Tab or It bug? i can not see. thank you for answer.
This was removed for performance reasons, but a lot of us asked for it to go back in.
Don't know if it is currently planned, so better request this at the SQL Developer Exchange, so other users can vote and add weight for possible sooner implementation.
Regards,
K. -
How can I search multiple columns in a SQL command of Union tables
Hi:
We have a database with tables that are nearly identical that we use for production and production history.
I have created an SQL command in Crystal 2008 to joins several of the tables and then added a "UNION" to connect the History and Prod tables.
I need to search multiple (3 total) columns for 5 different data types, to return the records being investigated. I tried this using an "OR" statement in the where clause and have had inconsistant results.
The first two or statement function perfectly the third works as long as the value being passed is numeric and the last two fail consistantly with invalid column name errors. It appears that crystal is getting confused and passing the wrong data type especially if I do a new search using a different option for the "?SearchParam"
Can some one offer some insite on how I can search these fields to return the record data needed
-- {?SearchParam} is the search parameter passed by Crystal that is a number 1 thru 5
-- {?Search_Val} is a parameter that is passed by Crystal that is a string of what to search for 1 = Numeric CMP ord #("TBSLI21"."LI21_OR_NO"), 2 = Numeric CI ord # ( "TBSLI33"."LI33_CI_OR_NO"),
-- 3 =String Ext Sys ord string ("TBSLI33"."LI33_EXT_SYS_SL_OR_NO"), 4 = String CMP Grp string ("TBSLI21"."LI21_OP_GRP_NO"), 5 = composit string PP ord string ("TBSOP13"."OP13_CLR_DAY" & "TBSOP13"."OP13_PP_GRP_SEQ_NO" & "TBSOP13"."OP13_CELL_ID")
SELECT "TBSLI21"."LI21_OR_NO",
"TBSLI21"."LI21_SH_DT_SCDL",
"TBSLI21"."LI21_TS_EN_ORIG",
"TBSLI21"."LI21_TS_SHIP",
"TBSLI21"."LI21_SYS_ORD_CD",
"TBSLI21"."LI21_SHIP_ID",
"TBSLI21"."LI21_WRKST_ID",
"TBSLI21"."LI21_LI_NO",
"TBSLI33"."LI33_CI_OR_NO",
"TBSLI33"."LI33_EXT_SYS_SL_OR_NO",
"TBSLI21"."LI21_OP_GRP_NO",
"TBSLI21"."LI21_LI_STAT",
"TBSOP13"."OP13_OP_GRP_STAT",
"TBSLI31"."LI31_LI_EV_DTL_TX",
"TBSLI31"."LI31_DT_EN",
"TBSLI31"."LI31_TM_EN",
"TBSLI31"."LI31_LI_EV",
"TBSLI21"."LI21_OP_WSH_FLNM",
"TBSLI21"."LI21_PR_ITF_CD",
"TBSLI21"."MFG_PLANT_CD",
"MFG_PLANT_LI"."MFG_PLANT_CD" as PrefPlant,
"TBSOP13"."OP13_OP_GRP_DSP_CD",
"TBSLI21"."LI21_LI_DSP_CD",
"TBSOP13"."OP13_CLR_DAY",
"TBSOP13"."OP13_PP_GRP_SEQ_NO",
"TBSOP13"."OP13_CELL_ID",
"MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG",
"TBSLI21"."LI21_OP_GRP_PS_NO1",
"TBSLI21"."LI21_POMS_MERGE_NO",
"TBSLI31"."LI31_OP_ID",
"TBSLI21"."LI21_LI_POR_FG",
"TBSLI21"."LI21_BIN_ID",
"TBSLI21"."LI21_TS_MRSHL",
"TBSLI33"."LI33_CI_LI_NO",
"TBSLI33"."LI33_SH_ADDR_1",
"TBSLI33"."LI33_SH_ADDR_2",
"TBSLI33"."LI33_SH_ADDR_3",
"TBSLI33"."LI33_SH_ADDR_4",
"TBSLI33"."LI33_SH_CITY_NM",
"TBSLI33"."LI33_SH_ST_NM",
"TBSLI33"."LI33_SH_ZIP_CD",
"TBSLI33"."LI33_CU_NM",
"TBSLI33"."LI33_CU_BUS_NM"
FROM ((("CMPREPORTING"."dbo"."TBSLI33" "TBSLI33" FULL OUTER JOIN "CMPREPORTING"."dbo"."TBSLI21" "TBSLI21" ON ("TBSLI33"."LI33_BS_OR_NO"="TBSLI21"."LI21_OR_NO") AND ("TBSLI33"."LI33_BS_LI_NO"="TBSLI21"."LI21_LI_NO")) LEFT OUTER JOIN "CMPREPORTING"."dbo"."TBSOP13" "TBSOP13" ON "TBSLI21"."LI21_OP_GRP_NO"="TBSOP13"."OP13_OP_GRP_NO") LEFT OUTER JOIN "CMPREPORTING"."dbo"."TBSLI31" "TBSLI31" ON ("TBSLI21"."LI21_OR_NO"="TBSLI31"."LI31_OR_NO") AND ("TBSLI21"."LI21_LI_NO"="TBSLI31"."LI31_LI_NO")) LEFT OUTER JOIN "CMPREPORTING"."dbo"."MFG_PLANT_LI" "MFG_PLANT_LI" ON ("TBSLI21"."LI21_OR_NO"="MFG_PLANT_LI"."OR_NO") AND ("TBSLI21"."LI21_LI_NO"="MFG_PLANT_LI"."LI_NO")
WHERE {?aSearchParam} = 1 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI21"."LI21_OR_NO"=Cast( {?Search_Val} as Int)
or {?aSearchParam} = 2 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI33"."LI33_CI_OR_NO"=Cast( {?Search_Val} as numeric(12,0))
or {?aSearchParam} = 3 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(20),"TBSLI33"."LI33_EXT_SYS_SL_OR_NO")= Convert( VarChar(20), {?Search_Val})
or {?aSearchParam} = 4 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8),"TBSLI21"."LI21_OP_GRP_NO") = Convert( VarChar(8), {?GroupNo})
or {?aSearchParam} = 5 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8), ("TBSOP13"."OP13_CLR_DAY" & "TBSOP13"."OP13_PP_GRP_SEQ_NO" & "TBSOP13"."OP13_CELL_ID")) = Convert( VarChar(8), {?GroupNo})
Union
SELECT "TBSLI21_HIST"."LI21_OR_NO",
"TBSLI21_HIST"."LI21_SH_DT_SCDL",
"TBSLI21_HIST"."LI21_TS_EN_ORIG",
"TBSLI21_HIST"."LI21_TS_SHIP",
"TBSLI21_HIST"."LI21_SYS_ORD_CD",
"TBSLI21_HIST"."LI21_SHIP_ID",
"TBSLI21_HIST"."LI21_WRKST_ID",
"TBSLI21_HIST"."LI21_LI_NO",
"TBSLI33_HIST"."LI33_CI_OR_NO",
"TBSLI33_HIST"."LI33_EXT_SYS_SL_OR_NO",
"TBSLI21_HIST"."LI21_OP_GRP_NO",
"TBSLI21_HIST"."LI21_LI_STAT",
"TBSOP13_HIST"."OP13_OP_GRP_STAT",
"TBSLI31_HIST"."LI31_LI_EV_DTL_TX",
"TBSLI31_HIST"."LI31_DT_EN",
"TBSLI31_HIST"."LI31_TM_EN",
"TBSLI31_HIST"."LI31_LI_EV",
"TBSLI21_HIST"."LI21_OP_WSH_FLNM",
"TBSLI21_HIST"."LI21_PR_ITF_CD",
"TBSLI21_HIST"."MFG_PLANT_CD",
"MFG_PLANT_LI_HIST"."MFG_PLANT_CD",
"TBSOP13_HIST"."OP13_OP_GRP_DSP_CD",
"TBSLI21_HIST"."LI21_LI_DSP_CD",
"TBSOP13_HIST"."OP13_CLR_DAY",
"TBSOP13_HIST"."OP13_PP_GRP_SEQ_NO",
"TBSOP13_HIST"."OP13_CELL_ID",
"MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG",
"TBSLI21_HIST"."LI21_OP_GRP_PS_NO1",
"TBSLI21_HIST"."LI21_POMS_MERGE_NO",
"TBSLI31_HIST"."LI31_OP_ID",
"TBSLI21_HIST"."LI21_LI_POR_FG",
"TBSLI21_HIST"."LI21_BIN_ID",
"TBSLI21_HIST"."LI21_TS_MRSHL",
"TBSLI33_HIST"."LI33_CI_LI_NO",
"TBSLI33_HIST"."LI33_SH_ADDR_1",
"TBSLI33_HIST"."LI33_SH_ADDR_2",
"TBSLI33_HIST"."LI33_SH_ADDR_3",
"TBSLI33_HIST"."LI33_SH_ADDR_4",
"TBSLI33_HIST"."LI33_SH_CITY_NM",
"TBSLI33_HIST"."LI33_SH_ST_NM",
"TBSLI33_HIST"."LI33_SH_ZIP_CD",
"TBSLI33_HIST"."LI33_CU_NM",
"TBSLI33_HIST"."LI33_CU_BUS_NM"
FROM ((("CMPREPORTING"."dbo"."TBSLI33_HIST" "TBSLI33_HIST" FULL OUTER JOIN "CMPREPORTING"."dbo"."TBSLI21_HIST" "TBSLI21_HIST" ON ("TBSLI33_HIST"."LI33_BS_OR_NO"="TBSLI21_HIST"."LI21_OR_NO") AND ("TBSLI33_HIST"."LI33_BS_LI_NO"="TBSLI21_HIST"."LI21_LI_NO")) LEFT OUTER JOIN "CMPREPORTING"."dbo"."TBSOP13_HIST" "TBSOP13_HIST" ON "TBSLI21_HIST"."LI21_OP_GRP_NO"="TBSOP13_HIST"."OP13_OP_GRP_NO") LEFT OUTER JOIN "CMPREPORTING"."dbo"."TBSLI31_HIST" "TBSLI31_HIST" ON ("TBSLI21_HIST"."LI21_OR_NO"="TBSLI31_HIST"."LI31_OR_NO") AND ("TBSLI21_HIST"."LI21_LI_NO"="TBSLI31_HIST"."LI31_LI_NO")) LEFT OUTER JOIN "CMPREPORTING"."dbo"."MFG_PLANT_LI_HIST" "MFG_PLANT_LI_HIST" ON ("TBSLI21_HIST"."LI21_OR_NO"="MFG_PLANT_LI_HIST"."OR_NO") AND ("TBSLI21_HIST"."LI21_LI_NO"="MFG_PLANT_LI_HIST"."LI_NO")
WHERE {?aSearchParam} = 1 and "MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI21_HIST"."LI21_OR_NO"= Cast( {?Search_Val} as Int)
or {?aSearchParam} = 2 and "MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI33_HIST"."LI33_CI_OR_NO"= Cast( {?Search_Val} as numeric(12,0))
or {?aSearchParam} = 3 and "MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(20), "TBSLI33_HIST"."LI33_EXT_SYS_SL_OR_NO")= Convert( VarChar(20),{?Search_Val})
or {?aSearchParam} = 4 and "MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8),"TBSLI21_HIST"."LI21_OP_GRP_NO")= Convert( VarChar(8), {?GroupNo} )
or {?aSearchParam} = 5 and "MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8), ("TBSOP13_HIST"."OP13_CLR_DAY" & "TBSOP13_HIST"."OP13_PP_GRP_SEQ_NO" & "TBSOP13_HIST"."OP13_CELL_ID")) = Convert( VarChar(8), {?GroupNo})This is actually a fairly easy fix - because of the way the "OR" works in SQL, you need to surround each "set" of statements in the or with parentheses. So, it would look something like this:
Where
({?aSearchParam} = 1 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI21"."LI21_OR_NO"=Cast( {?Search_Val} as Int))
or
({?aSearchParam} = 2 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI33"."LI33_CI_OR_NO"=Cast( {?Search_Val} as numeric(12,0)))
or
({?aSearchParam} = 3 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(20),"TBSLI33"."LI33_EXT_SYS_SL_OR_NO")= Convert( VarChar(20), {?Search_Val}))
or
({?aSearchParam} = 4 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8),"TBSLI21"."LI21_OP_GRP_NO") = Convert( VarChar(8), {?GroupNo}))
or
({?aSearchParam} = 5 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8), ("TBSOP13"."OP13_CLR_DAY" & "TBSOP13"."OP13_PP_GRP_SEQ_NO" & "TBSOP13"."OP13_CELL_ID")) = Convert( VarChar(8), {?GroupNo}))
-Dell -
How to create alternate color columns in MS SQL reporting services (rdl)
I found something related to row coloring at ::
http://weblogs.sqlteam.com/joew/archive/2008/08/20/60691.aspx
i went through all the properties for column but none that would help me achive me goal.
SO in my case .. the no of rows are fixed .. but columns vary .. so i wnat the alternate columns to be of different color (say white and silver)Hi,
Once my no of data sets (mine is 3 columns per data set) changes, the highlighting 'shifted' like below. Any idea how this happen? -
How to track only one column updated in SQL Server 2012?
Is there a way to only track one specific column named Newsletter (bit format) of a table only when any record in that column has been changed from False to True?
e.g. In SQL Serer 2012, I have a table named tblSignupHistory. so i originally set the query like this:
ALTER TABLE tblSignupHistory
ENABLE CHANGE_TRACKING
WITH(TRACK_COLUMNS_UPDATED = ON)
and in my stored procedure, if any data is changed, SQL Server will automatically send me an email notification.
BUT i only want the notification email to be send only when this one specific column's value is changed from 0 to 1 (False to True). Any changes in other columns for the same table can be ignored.
Thanks.Blog on the topic:
http://www.exacthelp.com/2012/03/send-email-when-data-of-any-columns-of.html
QUOTE: "Over all idea
1. Enable the change tracking (CT) in database
2. Enable the change tracking (CT) in table
3. Enabled and configure the database mail
4. Create a stored procedure which will get data change using CT and send an email
5. Create a sql sever agent job which will execute the procedure in every 10 second.
Alternate solutions blog on the topic: Get an alert when a certain record changes in SQL Server
SQL Server UPDATE() function:
http://technet.microsoft.com/en-us/library/ms177523.aspx
Kalman Toth Database & OLAP Architect
Free T-SQL Scripts
New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012 -
How to Update a particular column with custom SQL in JHeadstart
Hi Friends,
I was trying to keep an update SQL statement in VO (missing right Parenthesis exception is thrown)
Please to let you know about my Requirement.
I have a column in Sales_Person Table "TARGET' and in Sales_Admin Table "INCENTIVE"
So Admin will allot a particular Amount in Incentive column for all the sales. (i.e globally for one and all)
When a Sales_Person enter a target of some number say 80 in the Target field.
while saving i want to deduct the target from incentive and the result must be update in Incentive column.
can you please suggest me where should i keep this functionality
Can you please help me out in solving this issue.
Thanks in advance.
RahulRahul,
You can do this in the doDMl method of your Entity Object.
See this white paper:
http://www.oracle.com/technology/products/jdev/collateral/papers/10131/businessrulesinadfbctechnicalwp.pdf
If you have follow-up questions, please use the JDeveloper forum, since your question is not related to JHeadstart.
Steven Davelaar,
JHeadstart Team. -
Copy only one column of the workbook1 and paste it in another workbook 2
Hello Rishi. Please help me with this how to copy only one column C of the workbook1 and paste it in another workbook 2 in Column D so that When user execute workbook1 . and then execute workbook2 . Column D is automatically populated in Workbook2 based on the data in Column C in workbook 1
Please help
Thanks
SoniyaHi Soniya
As I mentioned earlier, I haven't come across a situation of copying data from one workbook to another. However, for doing some dynamic modifications within the different sheets of the same workbook, you can refer to the following thread:
Comparing two queries with VBA macro
Thanks,
Rishi -
Hi,
How to compare two LONG columns ?
Is there a standard methode ?
Nicolas.Hi,
I found myself a solution :
Create table to migrate long to clob
after what, I can use package dbms_lob.compare
Nicolas. -
How to convert rows into column
Hi,
can any one help me how to convert rows into column by pl/sql procedure.
Thanks and Regardshttp://www.oracle.com/technology/oramag/code/tips2004/050304.html
-- dropping the sample table if exists
drop table rowstocol
-- create sample table
create table rowstocol ( name varchar2(20));
-- Inserting rows into sample table
insert into rowstocol values('Amit Zhankar');
insert into rowstocol values('Piyu Yawalkar');
insert into rowstocol values('Piyu Yawalkar');
insert into rowstocol values('Ashish Ghelani');
insert into rowstocol values('Aditi Zhankar');
insert into rowstocol values('Tom Kyte');
insert into rowstocol values('Oracle');
-- Following query should be run to create a sql. This result sql should be run to convert rows to column.
-- The following query uses just the tablename (whose data is to be converted) and name of the column (which is to be converted).
-- Example taken here is table rowstocol, column name.
SELECT cc
FROM (select decode(rn ,1 ,'Select ',null) ||' MAX (CASE WHEN dr = '|| rownum||' THEN DECODE (rn,1, col1) END) '||
decode(rn,maxr,' col1 from ','||'||chr(39)||','||chr(39)||'|| ') cc,rn,maxr
from (SELECT ROWNUM rn,count(0) over() maxr FROM rowstocol) order by rn) trows
union all
select '(SELECT tabs.col1, DENSE_RANK () OVER (ORDER BY col1,rowid) dr,dense_rank() OVER (order by 1) rn
FROM (SELECT NAME col1 FROM rowstocol) tabs ) group by rn' cc from dual;
-- The result of this query will do the reqd conversion from row to column.
-- Replace table rowstocol by your table, column name by your column.
CC
Select MAX (CASE WHEN dr = 1 THEN DECODE (rn,1, col1) END) ||','||
MAX (CASE WHEN dr = 2 THEN DECODE (rn,1, col1) END) ||','||
MAX (CASE WHEN dr = 3 THEN DECODE (rn,1, col1) END) ||','||
MAX (CASE WHEN dr = 4 THEN DECODE (rn,1, col1) END) ||','||
MAX (CASE WHEN dr = 5 THEN DECODE (rn,1, col1) END) ||','||
MAX (CASE WHEN dr = 6 THEN DECODE (rn,1, col1) END) ||','||
MAX (CASE WHEN dr = 7 THEN DECODE (rn,1, col1) END) ||','||
MAX (CASE WHEN dr = 8 THEN DECODE (rn,1, col1) END) col1 from
(SELECT tabs.col1, DENSE_RANK () OVER (ORDER BY col1,rowid) dr,dense_rank() OVER (order by 1) rn
FROM (SELECT NAME col1 FROM rowstocol) tabs ) group by rn
Select MAX (CASE WHEN dr = 1 THEN DECODE (rn,1, col1) END) ||','||
MAX (CASE WHEN dr = 2 THEN DECODE (rn,1, col1) END) ||','||
MAX (CASE WHEN dr = 3 THEN DECODE (rn,1, col1) END) ||','||
MAX (CASE WHEN dr = 4 THEN DECODE (rn,1, col1) END) ||','||
MAX (CASE WHEN dr = 5 THEN DECODE (rn,1, col1) END) ||','||
MAX (CASE WHEN dr = 6 THEN DECODE (rn,1, col1) END) ||','||
MAX (CASE WHEN dr = 7 THEN DECODE (rn,1, col1) END) ||','||
MAX (CASE WHEN dr = 8 THEN DECODE (rn,1, col1) END) col1 from
(SELECT tabs.col1, DENSE_RANK () OVER (ORDER BY col1,rowid) dr,dense_rank() OVER (order by 1) rn
FROM (SELECT NAME col1 FROM rowstocol) tabs ) group by rn;
COL1
Aditi Zhankar,Amit Zhankar,Ashish Ghelani,Oracle,Oracle,Piyu Yawalkar,Piyu Yawalkar,Tom Kyte
Edited by: bhooma on Jan 20, 2009 2:44 AM -
How to find out the length of a LONG column?
How can I find out the length of a LONG column, I should write a stored procedure which will return me the length of a LONG column passed as an argument to it!
any ideas or suggestions? please respond, i need this urgently, or you can mail me at [email protected]
thanks,
sriniActually a LONG variable in PL/SQL maxes out at 32K, so this would not be accruate. If you are running Oracle 8+, you could do a conversion to LOB which will give you an accurate length. Note, this example needs a table created to hold the converted lob value, you can't do it directly in pl/sql:
create table lobhold
(templob clob);
declare
mylength number;
begin
execute immediate 'insert into lobhold select to_lob(text) from equipment_notes where equipment_id=1448';
select dbms_lob.getlength(templob) into mylength
from templob;
dbms_output.put_line(mylength);
execute immediate 'truncate table lobhold';
end; -
How to copy complete column data of a table control similar to ALV
Hi All,
I have a senario where i need to select one column of a Table control and press Ctrlc then the complete column details should be copied and be able to paste it in another colum using ctrlv.
please suggest me how can i copy the complete column data similar to ALV .
Thanks in advance .
Edited by: ravi kumar on Sep 13, 2011 2:53 PMDear Ravi
I'm afraid there is no standard functionality for copy paste in ALV.
You would need to develop something to achieve that - a button for example.
Kind Regards
/Ricardo Quintas -
How to retrieve 'long' column with 32K length in Java stored procedure
For some reasons, we are not using CLOB, BLOB, or BFILE to store large objects and I have to live with LONG. So I wrote a Java stored procedure to insert, select and manipulate a LONG column by retrieving the LONG into a java.lang.String class (which happens to be the Java class mapped to the LONG SQL datatype). It all works fine as long as the length of the value being retrieved is less than the magic figure of 32767 bytes (which is the restriction on LONG and VARCHAR2 datatype in PL/SQL as well). So looks like Oracle's implementation of the JVM limits String values to a max of 32767 bytes. Suggestions on how to overcome this limitation (other classes that you suggest or do I have to move to files)?
Thanks,
Jeet
nullthe jvm has nothing to do with it ...
this is a pol/sql limitation on parameters in stored procedures.
and java stored procedures require a clal spec that makes the j-s-p look like a pl/qsl stored proc. -
How to get an XML string store in CLOB or LONG column ?
How to get an XML string store in CLOB or LONG column ?
We use XSU with the following command
String str = qry.getXMLString();
but all the "<" are replace by "<"
It's impossible to parse the result for XSLT transformation
Thank's for your help
Denis Calvayrac
Example :
in the column "TT_NAME"
"<name><firstname>aaa</<firstname><lastname>bbb</lastname></name>
I want this result
<TT_NAME>
<name>
<firstname>aaa</firstname>
<lastname>bbb</lastname>
</name>
</TT_NAME>
but, I have this result
<TT_NAME>
<name>
<firstname>aaa</firstname>
<lastname>bbb</lastname>
</name>
</TT_NAME>Can you post some of your code, so I can take a look ?
Thanks
Maybe you are looking for
-
How can i convert a window media player file into a format playable on ipod
hey guys can you tell me how can i convert an widdow media player file into a format that can be played on my ipod, i used videora ipod converter but it can't convert the window media player file
-
Leopard and Adobe CS3 Products. Design and Video Production a must read.
Adobe posted this pdf. http://www.adobe.com/support/products/pdfs/leopardsupport.pdf Should answer any questions on compatibility. Web designers are safe if you use CS3. Studio 8, your out of luck. InDesign CS3, Photoshop CS3, Illustrator CS3 is safe
-
Should I cancel consumer finance cards?
I recently got approved for a new Discover it card. On a letter that I received with the new card it had my credit score, factors, etc. One of the factors said TOO MANY CONSUMER FINANCE ACCOUNTS. From doing research I see that these are typically ca
-
Hello all I currently own an ADS Pyro device to handle video previews between my computer and a HD TV. I am working all in HD now, and the device does not handle HD (it is 4 years old). While it worked well for SD and analog captures, I always had li
-
Podcast Producing in a Windows World
I'm running into some major issues at the school I work for trying to get Podcast Producer up and running. I've got an Apple Xserve with 10.5.1 that is a member of a Windows Active Directory Domain (No way for that to change). My question really appl