Comparing columns in table and triggers
hi masters,
i have oracle 10g in Linux and us PL/SQL developer to access database, ia m not a developer, but am assigned task to compare columns in table and associated trigger.
let me explain, we have 800 tables, and each table essentially have a trigger created on it. the condition is that each trigger on table should include each column in table, that is columns in table and trigger should be same.
now i don't understand how to compare them, rather can you suggest any query for the same?? and comparing 800 tables manually will be tedious job...
i am unable to compare trigger columns with that of tables..
how can we achieve this???
any suggestions??
thanks and regards
VD
Hi,
A good starting point could be consult user_triggers view. Example:
Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
Connected as hr
SQL> desc user_triggers
Name Type Nullable Default Comments
TRIGGER_NAME VARCHAR2(30) Y Name of the trigger
TRIGGER_TYPE VARCHAR2(16) Y Type of the trigger (when it fires) - BEFORE/AFTER and STATEMENT/ROW
TRIGGERING_EVENT VARCHAR2(227) Y Statement that will fire the trigger - INSERT, UPDATE and/or DELETE
TABLE_OWNER VARCHAR2(30) Y Owner of the table that this trigger is associated with
BASE_OBJECT_TYPE VARCHAR2(16) Y
TABLE_NAME VARCHAR2(30) Y Name of the table that this trigger is associated with
COLUMN_NAME VARCHAR2(4000) Y The name of the column on which the trigger is defined over
REFERENCING_NAMES VARCHAR2(128) Y Names used for referencing to OLD, NEW and PARENT values within the trigger
WHEN_CLAUSE VARCHAR2(4000) Y WHEN clause must evaluate to true in order for triggering body to execute
STATUS VARCHAR2(8) Y If DISABLED then trigger will not fire
DESCRIPTION VARCHAR2(4000) Y Trigger description, useful for re-creating trigger creation statement
ACTION_TYPE VARCHAR2(11) Y
TRIGGER_BODY LONG Y Action taken by this trigger when it fires
SQL> select * from user_triggers;
TRIGGER_NAME TRIGGER_TYPE TRIGGERING_EVENT TABLE_OWNER BASE_OBJECT_TYPE TABLE_NAME COLUMN_NAME REFERENCING_NAMES WHEN_CLAUSE STATUS DESCRIPTION ACTION_TYPE TRIGGER_BODY
TRGTEST BEFORE STATEMENT INSERT HR TABLE DEPARTMENTS REFERENCING NEW AS NEW OLD AS OLD ENABLED trgTest PL/SQL DECLARE
before insert on departments -- local variables here
BEGIN
nul;
END trgTest;
UPDATE_JOB_HISTORY AFTER EACH ROW UPDATE HR TABLE EMPLOYEES REFERENCING NEW AS NEW OLD AS OLD ENABLED update_job_history PL/SQL BEGIN
AFTER UPDATE OF job_id, department_id ON employees add_job_history(:old.employee_id, :old.hire_date, sysdate,
FOR EACH ROW
SECURE_EMPLOYEES BEFORE STATEMENT INSERT OR UPDATE OR DELETE HR TABLE EMPLOYEES REFERENCING NEW AS NEW OLD AS OLD ENABLED secure_employees PL/SQL BEGIN
BEFORE INSERT OR UPDATE OR DELETE ON employees secure_dml;
END secure_employees;
RK_ALT_BEF_TRG AFTER EVENT ALTER HR SCHEMA REFERENCING NEW AS NEW OLD AS OLD ENABLED rk_alt_bef_trg PL/SQL BEGIN
AFTER ALTER ON HR.SCHEMA dbms_output.put_line('AFTER Schema trigger fired');
dbms_output.
SQL> Regards,
Similar Messages
-
To compare two internal tables and delete records
Hi friends,
I have to compare two internal tables and should delete the records which is not present in both the tables. Reply me as soon as possible.
Thanks.Hi Nagarajan,
1. I don't think there is any direct (one-shot statement)
way to achieve this.
one has to do by writing some logic.
2. Loop at ITAB1.
Read table ITAB2 with key Field1 = ITAB1-Field1.
If sy-subrc <> 0.
delete ITAB1.
endif.
Endloop.
Do the same again with ITAB2.
Loop at ITAB2.
Read table ITAB1 with key Field1 = ITAB2-Field1.
If sy-subrc <> 0.
delete ITAB2.
endif.
Endloop.
3. If any better way is found, i will let u know.
Hope it helps.
Regards,
Amit M. -
Comparing two internal tables and deleting the record not present in second
Hi All,
I have a internal table itaba with PERNR as primary key and various other columns (1000 records) and table B with PERNR as primary key and 800 records.
Now what is the best way to compare these two and delete the record from table A when its corresponding record is not present in table B?
Thanks and Regards,
MohanHI SIR
u trained us in accenture
Hi all
when ever m running this session in SM35 , M getting error as :
"LEAVE TO TRANSACTION" MARA-BISMT is not allow
in batch input
REPORT YASEC_BDC_NIK_SESSION
no standard page heading
message-id zmm
line-count 65
line-size 150.
tables : mara.
*Top includr program
INCLUDE YNEW_MAIN_TOP.
*include yasec_bdc_nik_session_top.
***********selection screen *******************
selection-screen begin of block b1 with frame title text-001.
selection-screen skip.
PARAMETERS: p_ifile(128) TYPE c .
SELECTION-SCREEN SKIP.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS: rad1 TYPE c RADIOBUTTON GROUP 1 USER-COMMAND gr1,
rad2 TYPE c RADIOBUTTON GROUP 1 .
SELECTION-SCREEN SKIP.
PARAMETERS: p_sess TYPE c.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN END OF BLOCK b1.
Subroutine call***************************
INCLUDE YNEW_MAIN_F01.
*include yasec_bdc_nik_session_f01.
*********At selection event triggered *************
at selection-screen on value-request for p_ifile.
To get F4 help for the input file path
PERFORM f_f4_input_file.
AT SELECTION-SCREEN ON p_ifile.
To validate and upload the input file
PERFORM f_load_file.
AT SELECTION-SCREEN ON p_sess.
To validate the Number of Sessions field
IF rad2 IS NOT INITIAL AND sy-ucomm EQ c_onli.
PERFORM f_check_sessions.
ENDIF.
***********Start of selection *******************
start-of-selection.
*To process BDC
PERFORM f_process_bdc.
TOP OF PAGE
TOP-OF-PAGE.
Writes the report heading and for displaying line number.
PERFORM f_report_header.
TYPES : BEGIN OF t_final,
matnr(50) TYPE c,
bismt(18) type c,
end of t_final.
TYPES: BEGIN OF t_fdata,
data(256) TYPE c,
END OF t_fdata.
TYPES: BEGIN OF t_error,
message(100) TYPE c,
END OF t_error.
*Internal table declarations
*Internal table to load the data from the file that is changed throgh BDC
DATA : i_final TYPE STANDARD TABLE OF t_final,
wa_final TYPE t_final.
*Internal table to store the error messages
DATA : i_error TYPE STANDARD TABLE OF t_error,
wa_error TYPE t_error.
*Internal table to load the raw data
DATA : i_fdata TYPE STANDARD TABLE OF t_fdata,
wa_fdata TYPE t_fdata.
*Internal table to store records of BDC
DATA : i_bdcdata TYPE STANDARD TABLE OF bdcdata INITIAL SIZE 0,
wa_bdcdata TYPE bdcdata.
Internal table to store BDC messages
DATA: i_bdcmsgcoll TYPE STANDARD TABLE OF bdcmsgcoll INITIAL SIZE 0,
wa_bdcmsgcoll TYPE bdcmsgcoll.
VARIABLE DECLARATIONS
DATA: v_ifile TYPE string,
v_input TYPE i,
c_delimiter TYPE c VALUE 'X',
v_mode TYPE c VALUE 'A',
v_sessions TYPE i.
CONSTANTS
CONSTANTS : c_flagx TYPE c VALUE 'X',
c_slash TYPE c VALUE '/',
c_onli(4) TYPE c VALUE 'ONLI',
c_vl02(4) TYPE c VALUE 'VL02',
c_s TYPE c VALUE 'A'.
FORM f_f4_input_file .
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
IMPORTING
file_name = p_ifile.
ENDFORM. " f_f4_input_file
*& Form f_load_file
FORM f_load_file .
v_ifile = p_ifile.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_ifile
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = i_fdata
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc <> 0.
*Text-103-Input file does not exist.
MESSAGE e000 WITH text-103 .
ELSEIF NOT i_fdata IS INITIAL.
DELETE i_fdata WHERE data = space.
DESCRIBE TABLE i_fdata LINES v_input.
ENDIF.
IF v_input EQ 0.
Text-104 - Input file is empty.
MESSAGE e000 WITH text-104 .
ENDIF.
ENDFORM. " f_load_file
*& Form f_check_sessions
FORM f_check_sessions .
IF p_sess IS INITIAL.
MESSAGE e000 WITH text-106.
ELSE.
v_sessions = v_input DIV p_sess.
ENDIF.
ENDFORM. " f_check_sessions
*& Form f_process_bdc
text
FORM f_process_bdc.
LOOP AT i_fdata INTO wa_fdata.
SPLIT wa_fdata AT cl_abap_char_utilities=>horizontal_tab
INTO wa_final-matnr
wa_final-bismt.
APPEND wa_final TO i_final.
CLEAR wa_fdata.
ENDLOOP.
IF rad1 = c_flagx.
PERFORM f_passbdc_vl02.
ELSEIF rad2 = c_flagx.
PERFORM f_sessions_vl02.
ENDIF.
ENDFORM. "f_process_bdc
To populate the Screen information
p_program Program Name
p_dynpro Screen Number
FORM bdc_dynpro USING p_program TYPE any
p_dynpro TYPE any.
CLEAR wa_bdcdata.
Populate the BDC structure with the Screen Information.
Move the Program name PROGRAM
wa_bdcdata-program = p_program.
Move the Screen Number DYNPRO
wa_bdcdata-dynpro = p_dynpro.
Indicate the beginning of a new screen
wa_bdcdata-dynbegin = c_flagx.
APPEND wa_bdcdata TO i_bdcdata.
ENDFORM. "f_bdc_dynpro
*& Form f_passbdc_vl02
text
FORM f_passbdc_vl02.
DATA: l_lines_im TYPE i.
SORT i_final BY matnr ASCENDING.
CLEAR wa_final.
LOOP AT i_final INTO wa_final.
CLEAR: i_bdcmsgcoll[],
wa_bdcmsgcoll,
wa_bdcdata.
CLEAR: i_bdcdata[].
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RMMG1-MATNR'
wa_final-matnr.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
'X'.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MARA-BISMT'.
perform bdc_field using 'MARA-BISMT'
wa_final-bismt.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform bdc_transaction using 'MM02'.
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform bdc_transaction using 'MM03'.
CALL TRANSACTION 'MM02' USING i_bdcdata
MODE v_mode
UPDATE c_s
MESSAGES INTO i_bdcmsgcoll.
If error occurred in call transaction 'VA02' then stores all
information of failed records into internal table i_error_im.
IF sy-subrc NE 0.
DESCRIBE TABLE i_bdcmsgcoll LINES l_lines_im.
CLEAR wa_bdcmsgcoll.
READ TABLE i_bdcmsgcoll INTO wa_bdcmsgcoll INDEX l_lines_im.
To capture success and error messages in BDC.
CALL FUNCTION 'FORMAT_MESSAGE' "#EC *
EXPORTING
id = wa_bdcmsgcoll-msgid
lang = wa_bdcmsgcoll-msgspra
no = wa_bdcmsgcoll-msgnr
v1 = wa_bdcmsgcoll-msgv1
v2 = wa_bdcmsgcoll-msgv2
v3 = wa_bdcmsgcoll-msgv3
v4 = wa_bdcmsgcoll-msgv4
IMPORTING
msg = wa_error-message
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
ELSE.
WRITE: text-111 COLOR 7.
ENDIF.
CLEAR: wa_final.
REFRESH i_bdcdata.
ENDLOOP.
ENDFORM. "f_passbdc_va02
*& Form bdc_field
text
-->P_FNAM text
-->P_FVAL text
FORM bdc_field USING p_fnam TYPE any
p_fval TYPE any.
CLEAR wa_bdcdata.
Populate the Field Name
wa_bdcdata-fnam = p_fnam.
Populate the field value
wa_bdcdata-fval = p_fval.
APPEND wa_bdcdata TO i_bdcdata.
ENDFORM. "f_bdc_field
*& Form f_sessions_vl02
text
FORM f_sessions_vl02 .
DATA: l_sindex TYPE sy-tabix VALUE 1,
l_eindex TYPE sy-tabix,
l_flag TYPE c VALUE space.
l_eindex = v_input.
SORT i_final BY matnr ASCENDING.
DO p_sess TIMES.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
client = sy-mandt
group = 'Y_VL02_NIK'
user = sy-uname
keep = c_flagx
EXCEPTIONS
client_invalid = 1
destination_invalid = 2
group_invalid = 3
group_is_locked = 4
holddate_invalid = 5
internal_error = 6
queue_error = 7
running = 8
system_lock_error = 9
user_invalid = 10
OTHERS = 11.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CLEAR wa_final.
CLEAR: i_bdcdata[].
LOOP AT i_final INTO wa_final FROM l_sindex TO l_eindex .
IF l_flag = v_sessions.
CLEAR l_flag.
EXIT.
ENDIF.
l_flag = l_flag + 1.
CLEAR: i_bdcdata[].
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'RMMG1-MATNR'
wa_final-matnr.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_field using 'MSICHTAUSW-KZSEL(01)'
'X'.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'MARA-BISMT'.
perform bdc_field using 'MARA-BISMT'
wa_final-bismt.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform bdc_transaction using 'MM02'.
perform bdc_dynpro using 'SAPLMGMM' '0060'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_dynpro using 'SAPLMGMM' '0070'.
perform bdc_field using 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(01)'.
perform bdc_field using 'BDC_OKCODE'
'=ENTR'.
perform bdc_dynpro using 'SAPLMGMM' '4004'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'RMMG1-MATNR'.
perform bdc_dynpro using 'SAPLSPO1' '0300'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform bdc_transaction using 'MM03'.
l_sindex = l_sindex + 1.
ENDLOOP.
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
not_open = 1
queue_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDDO.
ENDFORM. " f_sessions_vl02
*& Form f_report_header
FORM f_report_header .
FORMAT COLOR COL_HEADING INTENSIFIED ON.
ULINE.
text-201 - Company: Carrier
text-102- Batch Data Communication.
text-202 - System: SAP
WRITE: /1 sy-vline,
3 text-201,
50 text-102,
100 text-202,
AT sy-linsz sy-vline.
text-203 - Program:
text-204 - Date/Time:
WRITE: /1 sy-vline,
3 text-203, sy-repid ,
100 text-204,sy-datum ,c_slash, sy-uzeit,
AT sy-linsz sy-vline.
text-205 - User ID:
text-206 - Page:
WRITE: /1 sy-vline,
3 text-205, sy-uname,
100 text-206, sy-pagno,
AT sy-linsz sy-vline.
FORMAT COLOR OFF.
ULINE.
ENDFORM. " f_report_header
FORM bdc_transaction USING tcode.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = tcode
TABLES
dynprotab = i_bdcdata
EXCEPTIONS
internal_error = 1
not_open = 2
queue_error = 3
tcode_invalid = 4
printing_invalid = 5
posting_invalid = 6
OTHERS = 7.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
WRITE: / text-109 ,wa_final-matnr,
text-110 .
ENDIF.
ENDFORM. "bdc_transaction -
Comparing records in tables and displaying them
Hi,
I have 2 sets of data as follows:
Set 1
AcctName |EffDt | ExpDt| BalAmt| Status|
ABC| 1-Jan-11| 31-Dec-11| 47500| Active|
DEF| 5-Jul-11| 4-Jul-12| 46204| Active|
GHZ| 5-Feb-11| 4-Feb-12| 43251| Active|
Set 2
AcctName | EffDt | ExpDt| BalAmt | Status|
ABC | 2 Jan 2010 | 1 Jan 2011 | 47500 | Exp|
XYZ | 5 Dec 2010 | 3 Dec 2011 | 46564 | Exp|
ABC | 11 Nov 2010| 10 Nov 2011 | 40142 | Exp|
I want to compare the set 2 data with set 1 data.
I need to get an output such that:
if there exists an Acct with same name and the ExpDt is equal to the Effdt then, the output should be the union of set 1 and set 2 and should not contain the that matching acct from set 2 since there exists a nonzero balanced latest Acct -
AcctName| EffDt | ExpDt | BalAmt | Status|
ABC | 1 Jan 2011 | 31 Dec 2011 | 47500 | Act|
DEF | 5 Jul 2011 | 4 Jul 2012 | 46204 | Act|
XYZ | 5 Dec 2010 | 3 Dec 2011 | 46564 | Exp|
GHZ | 5 Feb 2011 | 4 Feb 2012 | 43251 | Act |
ABC | 11 Nov 2010 | 10 Nov 2011 | 40142 | Exp|
Can you please help me in comparing these sets and get the desired output?
Note: Column Names
AcctName -> Account Name
EffDt -> Effective Date
ExpDt -> Expiry Date
BalAmt -> Balance Amount
Thanks & Regards,
869467Thanks for the reply.
Please find the scripts for table creation & insertions below-
create table set1(AcctName VARCHAR2(50), EffDt DATE, ExpDt DATE, BalAmt NUMBER(10), Status VARCHAR2(10));
insert into set1 values('ABC','1 Jan 2011','31 Dec 2011',47500,'Active');
insert into set1 values('DEF','5 Jul 2011','4 Jul 2012',46204,'Active');
insert into set1 values('GHZ','5 Feb 2011','4 Feb 2012',43251,'Active');
create table set2(AcctName VARCHAR2(50), EffDt DATE, ExpDt DATE, BalAmt NUMBER(10), Status VARCHAR2(10));
insert into set2 values('ABC','2 Jan 2010','31 Dec 2011',47500,'Active');
insert into set2 values('XYZ','5 Dec 2010','4 Dec 2011',46564,'Active');
insert into set2 values('ABC','11 Nov 2010','10 Nov 2011',40142,'Active');
Yes I need the output in almost the same way.
The output should not contain those accts records from set 2 where there exists a record for it in set1 on the expiry date of that acct.
Thanks & Regards,
869467 -
URGENT NEED HELP : JOURNALING TABLES AND TRIGGERS GENERATION
Hi
I need generate journaling tables for any tables to audit the update, delete statements executed for the users. I captured an existant schema, then and I change the derfiniton of the target tables, setting the value of Journaling to "Server".
But, when I generate the DDL statements, the triggers of the journaling tables don't appears in the sql file.
¿What is the error?
I thing that Designer generates the triggers and the journal tables, ¿It's true?
Thanks in advance.
XaviYou have to use the "Generate Table API" menu option. This will generate the "journalling" triggers.
HTH
Roel -
Error when adding columns to table and update sync group schema
Hi,
I have an Azure SQL Database that is synced to five lokal SQL Server Express 2012 clients. Today I had to add some columns to the tables, I did this using SMMS and ALTER TABLE on the hub-database.
Then I disabled auto-sync in the Azure Portal and updated the sync schema.
The first error I got when clicking on Save-Button was that my goup is not ready for syncing. I assumed that was caused by two sync agents who were offline. So I deleted them from the group and the error was gone. (is this an generall issue that all agents
must be online to update the schema?)
But then I got the next error when clicking on Save-Button who tells me SQL Error 207, invalid column name on the new columns I've added.
Here's the error in the eventlog:
id:DbProvider_SqlSyncScopeProvisioning_Error, rId:, sId:cc009538-29a6-4980-8db6-98fe520626b6, agentId:cb734c59-3484-41ed-8002-dec8cf7e21b4,
agentInstanceId:1aa5a36e-0dfb-4ff1-841a-c298d2e77fe7, syncGroupId:9d439cdd-de14-4e4d-a799-8a7fa518f533, syncGroupMemberId:dd2d6cdf-fdb3-4ff8-8ab5-8e639c35af47, hubDbId:d5c5615a-6f55-484a-8c76-cf335989fa41, tracingId:b5f0eb23-1ade-437b-af33-a1960ebd1c23, databaseId:a9c5ba71-a7b0-4ffe-ab8d-10b6006fc282,
sqlAzureActivityId:00000000-0000-0000-0000-000000000000, e:'Type=System.Data.SqlClient.SqlException,Message=Ungültiger Spaltenname 'Kunde_Name'.
Ungültiger Spaltenname 'Rechnung_gestellt'.
Ungültiger Spaltenname 'Rechnung_bezahlt'.
Ungültiger Spaltenname 'Kunde_Name'.
Ungültiger Spaltenname 'Rechnung_gestellt'.
Ungültiger Spaltenname 'Rechnung_bezahlt'.,Source=.Net SqlClient Data Provider,StackTrace=
bei System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
bei System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean
breakConnection, Action`1 wrapCloseInAction)
bei System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj,
Boolean callerHasConnectionLock, Boolean asyncClose)
bei System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler,
SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
bei System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean
async, Int32 timeout, Boolean asyncWrite)
bei System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion,
String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite)
bei System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
bei Microsoft.Synchronization.Data.SqlServer.SqlSyncTrackingTableHelper.UpdateTrackingTableWhereColumnsNotNullInBaseTable(SqlConnection
connection, SqlTransaction transaction, DbSyncColumnDescription[] addedColumns, DbSyncColumnDescription[] modifiedColumns, Int32 tableObjectId, SqlSyncMarkerTableHelper markerHelper)
bei Microsoft.Synchronization.Data.SqlServer.SqlSyncTableProvisioning.ReApply(SqlTransaction
trans, SqlSyncProviderAdapterConfiguration oldConfiguration)
bei Microsoft.Synchronization.Data.SqlServer.SqlSyncScopeProvisioning.ReApplyScope(SqlConnection
connection)
bei Microsoft.Synchronization.Data.SqlServer.SqlSyncScopeProvisioning.ReApplyInternal(SqlConnection
connection)
bei Microsoft.Synchronization.Data.SqlServer.SqlSyncScopeProvisioning.ReApply(),', eType:'Type=System.Data.SqlClient.SqlException',
eMessage:'Message=Ungültiger Spaltenname 'Kunde_Name'.
Ungültiger Spaltenname 'Rechnung_gestellt'.
Ungültiger Spaltenname 'Rechnung_bezahlt'.
Ungültiger Spaltenname 'Kunde_Name'.
Ungültiger Spaltenname 'Rechnung_gestellt'.
Ungültiger Spaltenname 'Rechnung_bezahlt'.' Error Code: -2146232060 - SqlError Number:207,
Message: Ungültiger Spaltenname 'Kunde_Name'.. SqlError Number:207, Message: Ungültiger Spaltenname 'Rechnung_gestellt'.. SqlError Number:207, Message: Ungültiger Spaltenname 'Rechnung_bezahlt'.. SqlError
Number:207, Message: Ungültiger Spaltenname 'Kunde_Name'.. SqlError Number:207, Message: Ungültiger Spaltenname 'Rechnung_gestellt'.. SqlError Number:207, Message: Ungültiger Spaltenname 'Rechnung_bezahlt'..
, eTypeInner:, eMessageInner:
Can anyone help here?
Kind
regards,
selmiacHello,
When you alter the table on hub database, did you specify the new column allow NULLs or have a DEFAULT? The column must allow NULLs or have a DEFAULT for the user to create it in the other tables on the sync group.
Reference:Add or remove a column in a sync group
If the issue persists, you may try to delete the sync group and recreate the group.
Regards,
Fanny Liu
Fanny Liu
TechNet Community Support -
How to compare two internal table and store value in third table
Dear All,
There is two tabel say I_T1 & T2, in I_T1 there are 4 rows , in T2 there are multiple rows against the same field. Say there is a filed X common in both table .
Value of I_T1-X are
10
20
50
90
and value ot T2-X are
10
15
20
30
40
50
.100
Now i want to fetch data form T2 against the common field of I_T1-X and store into other internal table.
Plz suggest me the proper way of doing this.
Rewards points assured for proper answer.
Regards,
Gulrez Alamhi this is like your requirement.
in this i am storing the values into the final table
REPORT ZZZZ000000.
tables:mara,marc,mard,makt.
data:begin of it_mara occurs 0,
matnr like mara-matnr,
mtart like mara-mtart,
meins like mara-meins,
end of it_mara.
data:begin of it_marc occurs 0,
matnr like marc-matnr,
pstat like marc-pstat,
werks like marc-werks,
end of it_marc.
data:begin of it_mard occurs 0,
werks like mard-werks,
lgort like mard-lgort,
labst like mard-labst,
end of it_mard.
data:begin of it_final occurs 0,
matnr like mara-matnr,
mtart like mara-mtart,
meins like mara-meins,
pstat like marc-pstat,
werks like marc-werks,
lgort like mard-lgort,
labst like mard-labst,
maktx like makt-maktx,
end of it_final.
select-options:s_matnr for mara-matnr.
select matnr
mtart
meins
from mara
into table it_mara
where matnr in s_matnr.
if not it_mara[] is initial.
select matnr
pstat
werks
from marc
into table it_marc
for all entries in it_mara
where matnr = it_mara-matnr.
if not it_marc[] is initial.
select werks
lgort
labst
from mard
into table it_mard
for all entries in it_marc
where werks = it_marc-werks.
endif.
endif.
loop at it_mara.
it_final-matnr = it_mara-matnr.
it_final-mtart = it_mara-mtart.
it_final-meins = it_mara-meins.
read table it_marc with key matnr = it_mara-matnr.
it_final-werks = it_marc-werks.
it_final-pstat = it_marc-pstat.
read table it_mard with key werks = it_marc-werks.
it_final-lgort = it_mard-lgort.
it_final-labst = it_mard-labst.
if sy-subrc = 0.
select maktx from makt into it_final-maktx where matnr = it_final-matnr.
endselect.
endif.
append it_final.
endloop.
loop at it_final.
write:/ it_final-matnr under 'material',
it_final-mtart under 'material type',
it_final-meins under 'unit of measure',
it_final-werks under 'plant' ,
it_final-pstat under 'status',
it_final-lgort under 'storage loc',
it_final-labst under 'stock',
it_final-maktx.
endloop.
reward points if useful,
venkat. -
PL/SQL Pipelined Function to Compare *ANY* 2 tables
I am trying to create a pipelined function in 10g R1 that will take the name of two tables, compare the the tables using dynamic SQL and pipe out the resulting rows using the appropriate row type. The pipelined function will be used in a DML insert statement.
For example:
create table a (f1 number, f2, date, f3 varchar2);
create table b (f1 number, f2, date, f3 varchar2);
create table c (f1 number, f2, date, f3 varchar2);
create or replace TYPE AnyCollTyp IS TABLE OF ANYTYPE;
create or replace TYPE CRowType IS c%ROWTYPE;
create or replace TYPE CRowTabType IS table of CRowType;
CREATE OR REPLACE FUNCTION compareTables (p_source IN VARCHAR2, p_dest IN VARCHAR2)
RETURN AnyCollTyp PIPELINED
IS
CURSOR columnCur (p_tableName IN user_tab_columns.table_name%TYPE)
IS
SELECT column_name, column_id
FROM user_tab_columns
WHERE table_name = p_tableName
ORDER BY column_id;
l_cur sys_refcursor;
l_rec ANYTYPE;
l_stmt VARCHAR2 (32767);
BEGIN
l_stmt := 'select ';
FOR columnRec IN columnCur (p_dest)
LOOP
l_stmt := l_stmt || CASE
WHEN columnRec.column_id > 1
THEN ','
ELSE ''
END || columnRec.column_name;
END LOOP;
l_stmt := l_stmt || ' from ' || p_source;
l_stmt := l_stmt || ' minus ';
l_stmt := l_stmt || ' select ';
FOR columnRec IN columnCur (p_dest)
LOOP
l_stmt := l_stmt || CASE
WHEN columnRec.column_id > 1
THEN ','
ELSE ''
END || columnRec.column_name;
END LOOP;
l_stmt := l_stmt || ' from ' || p_dest;
OPEN l_cur FOR l_stmt;
LOOP
FETCH l_cur
INTO l_rec;
PIPE ROW (l_rec);
EXIT WHEN l_cur%NOTFOUND;
END LOOP;
CLOSE l_cur;
RETURN;
END compareTables;
The pipelined function gets created without error. However, the testCompare procedure gets an error:
SQL> create or replace procedure testCompare is
begin
insert into c
select *
from (TABLE(CAST(compareTables('a','b') as cRowTabType)));
dbms_output.put_line(SQL%ROWCOUNT || ' rows inserted into c.');
end;
Warning: Procedure created with compilation errors.
SQL> show errors
Errors for PROCEDURE TESTCOMPARE:
LINE/COL ERROR
3/4 PL/SQL: SQL Statement ignored
5/47 PL/SQL: ORA-22800: invalid user-defined type
Does anyone know what I am doing wrong? Is there a better way to compare any two tables and get the resulting rows?904640 wrote:
Hi All,
Is it possible to post messages to weblogic JMS queue from pl/sql procedure/function?
From this Queue, message will be read by OSB interface.
Any help will be highly appreciated.
http://www.lmgtfy.com/?q=oracle+pl/sql+weblogic+jms+queue -
Show name field for two columns Fact Table joing by one Dimension
Hi all,
My question is about physical joins in Oracle BI EE.
Task is:
In a relational fact table "star" there is two columns Entity 1, Entity 2 and a table dimension Entity witch have two filds: ID and NAME. By loadind data fact table is filled with id for Entity 1 and Entity 2.
In a report made in Answers i need to show ID_Entity_1 NAME_Entity_1 ID_Entity_2 NAME_Entity_2
Question is: how to do physical join between two columns fact table and one dimension table entity so, that i can show name field in a report for both columns Entity 1, Entity 2.You must Create an alias in the physical layer of your table dimEnsion and use it as a second dimension table.
-
Dear All,
I have a script which creates tables and triggers and drop the tables.
I want to know if the triggers are dropped automatically when we drop the tables and when we create the tables what is the name of the tablespace that they are created in ?
thank you in advance for your replyTriggers are dropped automatically when you drop the associated table.
SQL> create table a (id number);
Table created.
SQL> create trigger trga before insert on a for each row
2 begin
3 null;
4 end;
5 /
Trigger created.
SQL> select trigger_name from user_triggers where table_name = 'A';
TRIGGER_NAME
TRGA
SQL> drop table a;
Table dropped.
SQL> select trigger_name from user_triggers where table_name = 'A';
no rows selected -
Compare of 2 tables with multiple output rows???
I have two table which hold port and process information from a network scan. One table is a baseline and the other is a recent scan. The tables contain the ports and services from all the systems scanned for each system.
I need to compare the two tables and show what the difference is. One report showing just the unique ports not in the baseline and another to show a complete list of all the ports not in the baseline and the associated computer name. I need both
the reports to be able to show if the difference is a port that was in the baseline that is not in the new scan or is a new port not in the baseline.
Here are the table formats I have:
Baseline
Date
Plant
ComputerName
Protocol
LocalAddress
LocalPort
RemoteAddress
RemotePort
State
ProcessName
Scan
Date
Plant
ComputerName
Protocol
LocalAddress
LocalPort
RemoteAddress
RemotePort
State
ProcessNametablediff:- Just find the tablediff.exe and change the sourceserver,source database -sourcetable and same thing you need to do it for destination.
Interchange it for the second run
C:\Program Files\Microsoft SQL Server\100\COM>tablediff.exe -SourceServer hqvd0026\kat -SourceDatabase dssp -sourcetable Baseline -DestinationServer hqvd0026\kat -DestinationDatabase dssp -destinationtable Scan -c -f c:\tablediff.sql
OR
A=A-B
The following query returns any distinct values from the query to the left of the EXCEPT operand
that are not also found on the right query.
select * from dbo.baseline
except
select * from dbo.scan
The following query returns any distinct values that are returned by both the query on the left and right sides of the INTERSECT operand.
select * from dbo.baseline
INTERSECT
select * from dbo.scan
-Prashanth -
Database Diff - One column and triggers won't fall off report
I'm trying to use the database diff tool (which I LOVE, by the way), and I'm getting just a few odd results. I'm comparing two databases and can never seem to get to where the diff report is empty, even though everything is the same. No matter what I do, it lists one column in a table as different and lists ALL 13 triggers in the database as different. I have tried dropping the table and all triggers in question and having the diff scripts recreate them, but when I try a diff again, they keep showing up as different somehow.
Also, the diff script is generating this as code to modify the column:
alter table "USERS" modify ( "UPID" NVARCHAR2 );
Which I don't think is valid syntax - I get "Missing left parentheses." I think it's because it doesn't like specifying the NVARCHAR2 type without a size. If I change that statement to NVARCHAR2(20), then the statement runs. However, as I said before, it still shows up in the diff report later on as if something is different, even though both databases are exactly the same.
I'm using SQL Developer 2.1.1.64 on Windows XP Pro. Database is 10g.Does the ext directory have the php_oci8.dll? In the original steps the PHP dir is renamed. In the given php.in the extension_dir looks like it has been updated correctly. Since PHP distributes php_oci8.dll by default I reckon there would be a very good chance that the problem was somewhere else. Since this is an old thread I don't think we'll get much value from speculation.
-- cj -
No of columns in a table and SQL performance
How does the table size effects sql performance?
I am comparing 2 tables , with same number of rows(54 million rows) ,
table1(columns a,b,c,d,e,f..) has 40 columns
table2 (columns (a,b,c,d)
SQL uses columns a,b.
SQL using table2 runs in 1 sec.
SQL using table1 runs in 30 min.
Can any one please let me know how the table size , number of columns in table efects the performance of SQL's?
Thanks
jeevan.user600431 wrote:
This is a general question. I just want to compare table with more columns and table with less columns with same number of rows .
I am finding that table with less columns is good in performance , than the table with more columns.
Assuming there are no row chains , will there be any difference in performance with the number of columns in a table.Jeevan,
the question is not how many columns your table has, but how large your table segment is. If your query runs a full table scan it has to read through the whole table segment, so in that case the size of the table matters.
A table having more columns potentially has a larger row size than a table with less columns but this is not a general rule. Think of large columns, e.g. varchar2 columns, think of blank (NULL) columns and you can easily end up with a table consisting of a single column taking up more space per row than a table with 200 columns consisting only of varchar2(1) columns.
Check the DBA/ALL/USER_SEGMENTS view to determine the size of your two table segments. If you gather statistics on the tables then the dictionary will contain information about the average row size.
If your query is using indexes then the size of the table won't affect the query performance significantly in many cases.
Regards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/ -
Compare two tables and log the difference
Hi,
I want to compare two tables and log the difference in new table with the fields as (old value,new value, column name). The column name should be the changes value columnCan you show an example?
SELECT Foo.*, Bar.*
FROM Foo
FULL OUTER JOIN
Bar
ON Foo.c1 = Bar.c1
AND Foo.c2 = Bar.c2
AND Foo.cn = Bar.cn
WHERE Foo.key IS NULL
OR Bar.key IS NULL;
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Compare 2 tables and insert rows missing in each table.
I have a tough situation. I have two exact tables- one online and one offline database. I know that there are missing rows of data from each table, so I need to make a comparison of one table and insert rows that do not exist. I was thinking to try this, but it took over 3 hours to run and did not return anything:
insert into t
select * from t a
where not exists (select * from [email protected] b
where a.col1 != b.col1
and a.col2 != b.col2
and a.col3 != b.col3);
and it goes on for another 7columns.
The trouble I have is to include a date clause so that the query can be broken down into running only a few months of data comparisions at a time- the records go back 4 years to compare. Also is there a way to write this so that it will query both tables at the same time in order to speed things up- or is one table at a time the best advice? Each table has over 100 million records to compare, that's why I was hoping to use a date criteria since one column is date.
Let me know what you advise to make this work, I hope I was on the right track.Not sure if the MINUS operator will perform better with your data set but;
SQL> create table t1 (some_id number, some_date date)
Table created.
SQL> create table t2 (some_id number, some_date date)
Table created.
SQL> insert into t1 values (1, trunc(sysdate))
1 row created.
SQL> insert into t1 values (2, trunc(sysdate-5))
1 row created.
SQL> insert into t1 values (4, trunc(sysdate-90))
1 row created.
SQL> insert into t2 values (1, trunc(sysdate))
1 row created.
SQL> insert into t2 values (3, trunc(sysdate-10))
1 row created.
SQL> insert into t2 values (5, trunc(sysdate-100))
1 row created.
SQL> select * from t1
SOME_ID SOME_DAT
1 07-07-30
2 07-07-25
4 07-05-01
3 rows selected.
SQL> select * from t2
SOME_ID SOME_DAT
1 07-07-30
3 07-07-20
5 07-04-21
3 rows selected.
SQL> insert into t1 (
select some_id, some_date from t2 where some_date between sysdate-50 and sysdate
minus
select some_id, some_date from t1 where some_date between sysdate-50 and sysdate)
1 row created.
SQL> insert into t2 (
select some_id, some_date from t1 where some_date between sysdate-50 and sysdate
minus
select some_id, some_date from t2 where some_date between sysdate-50 and sysdate)
1 row created.
SQL> select * from t1
SOME_ID SOME_DAT
1 07-07-30
2 07-07-25
4 07-05-01
3 07-07-20
4 rows selected.
SQL> select * from t2
SOME_ID SOME_DAT
1 07-07-30
3 07-07-20
5 07-04-21
2 07-07-25
4 rows selected.
Maybe you are looking for
-
UWL - Records not getting into LeaveRequestApproval web dynpro screen
Hi, We are on EP7 sp9 and ECC 6.0. We are working with UWL. In UWL, we downloaded the standard XML file and done changes for removing the other tabs except the 'Tasks' tab and also placed the refresh button on main screen. It looks fine. Now, the pro
-
How to call a controller from a different BSP application?
I have searched for the documentation, I have found literature that says it is possible but I am struggling with the syntax. I am in BSP 'MVC1' and upon a condition I would like to call the main controller of BSP 'MVC2'. What will be the syntax? Than
-
Where is the 0APO_C12 data source ?
Hello APO experts I want to load the 0APO_C12 cube but when trying to create the transfer rules, it says that the data source does not exist. Is there a special way for loading this cube ? Seraching the www did not yield good results. Tx
-
V$SQLAREA.sharable_mem column !!
Hi, all. What is the unit of V$SQLAREA.sharable_mem column, bytes or bits? One of sqls has the value of 4846245 in sharable_mem column! It means 4,846,245 bytes or bits? I cannot believe the sql is using 450 MegaBytes. In addition, which memory compo
-
White Screen happens sometimes. No total fix after rebooting.
I've been reading about the White Screen problem, and I didn't find solution to it. I also don't know why this happens. It started to happen without reason. I tried rebooting holding both buttons for 10 sec. and it worked, but when leaving the iPod a