Default Value , Not Null and EJB2.1
Hi ,
Am using Weblogic10.3 + Oracle Db + EJB2.1 Local Entity Beans .
The issue is that one of the table has createdDt which is not null and is defualt is set to Sysdate. When I try to create this Entity with createdDt null , I get an exception like below , But since I have mentioned default value , I shouldnt be getting this. Have I missed something ?
Code is quite straighforward
Organisation org = organisationHome.create();
....org.setter methods..
java.sql.SQLException: [BEA][Oracle JDBC Driver][Oracle]ORA-01400: cannot insert NULL into ("XXX"."ORGANISATION_T"."CREATEDDT_F")
ErrorCode=1400 SQLState=23000
java.sql.SQLException: [BEA][Oracle JDBC Driver][Oracle]ORA-01400: cannot insert NULL into ("XXX"."ORGANISATION_T"."CREATEDDT_F")
at weblogic.jdbc.base.BaseExceptions.createException(Unknown Source)
at weblogic.jdbc.base.BaseExceptions.getException(Unknown Source)
at weblogic.jdbc.oracle.OracleImplStatement.execute(Unknown Source)
at weblogic.jdbc.base.BaseStatement.commonExecute(Unknown Source)
at weblogic.jdbc.base.BaseStatement.executeUpdateInternal(Unknown Source)
at weblogic.jdbc.base.BasePreparedStatement.executeUpdate(Unknown Source)
at weblogic.jdbcspy.SpyPreparedStatement.executeUpdate(Unknown Source)
at weblogic.jdbc.wrapper.PreparedStatement.executeUpdate(PreparedStatement.java:159)
at weblogic.ejb.container.manager.BaseEntityManager.executeInsertStmt(BaseEntityManager.java:763)
at weblogic.ejb.container.internal.TxManager$TxListener.executeInsert(TxManager.java:900)
at weblogic.ejb.container.internal.TxManager$TxListener.executeDBOperations(TxManager.java:831)
at weblogic.ejb.container.internal.TxManager$TxListener.beforeCompletion(TxManager.java:1054)
at weblogic.transaction.internal.ServerSCInfo.doBeforeCompletion(ServerSCInfo.java:1217)
at weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(ServerSCInfo.java:1195)
at weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(ServerSCInfo.java:118)
at weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAndChain(ServerTransactionImpl.java:1302)
at weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(ServerTransactionImpl.java:2114)
at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:263)
at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:230)
at weblogic.ejb.container.internal.BaseRemoteObject.postInvoke1(BaseRemoteObject.java:621)
at weblogic.ejb.container.internal.StatelessRemoteObject.postInvoke1(StatelessRemoteObject.java:60)
at weblogic.ejb.container.internal.BaseRemoteObject.postInvokeTxRetry(BaseRemoteObject.java:441)
at com.tieto.tix.core.domain.DomainServices_7p8lqs_EOImpl.createOrganisation(DomainServices_7p8lqs_EOImpl.java:7717)
at com.tieto.tix.core.domain.DomainServices_7p8lqs_EOImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:589)
at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:230)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:477)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:473)
at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
parmTest( , "param2") is syntactically incorrect, so there can be no "workaround".
In addition to solutions offered by SwapnilVJ and Saransoft84, you could also use a rest parameter:
function parmTest(... args)
// set up default values
var val1:Boolean=true;
var val2:String="";
switch(args.length)
case 0:break;
case 1:
if(args[0] is String){val2=args[0] as String;}
else{val1=args[0] as Boolean;}
break;
case 2:
default:
val1=args[0] as Boolean;
val2=args[1] as String;
break;
trace(val1 + " " +val2);
parmTest();
parmTest("hello");
parmTest(null,"hello");
parmTest("hello",null);
Similar Messages
-
BOOLEAN DEFAULT FALSE NOT NULL for key-column
Hello,
These statements show an unexpected behavior when a column is added to a table as 'BOOLEAN DEFAULT FALSE NOT NULL' and added afterward to the table's primary key column set:
create table test_1 (a char(1))
insert into test_1 values('A')
alter table test_1 add b boolean default false not null
alter table test_1 add primary key (a,b)
create table test_2 (a char(1), b boolean default false not null)
insert into test_2 (a) values('A')
alter table test_2 add foreign key f_test_1 (a,b) references test_1 (a,b)
-> [350]: Referential integrity violated
update test_1 set b=false
alter table test_2 add foreign key f_test_1 (a,b) references test_1 (a,b)
-> success
delete from test_2
delete from test_1
insert into test_1 (a,b) values('A',false)
insert into test_2 (a) values('A')
-> success
I think the error message '[350] Referential integrity violated' should not happen because the column 'b' really contains 'false'. But there obviously seem to be a difference before and after setting the column 'b' explicitly to 'false'. I can imagine that this depends on the way how the index for the primary key is updated. Probably the index is not properly updated in this context(?)
GabrielHi Gabriel,
you're right, this is a bug and indeed seems to caused by the way the DEFAULT boolean is stored in the page.
(There is no separate index for the primary key in MaxDB as all data is stored in B*trees - basically the table is the primary key).
This is how the record looks like when column b is 'false' only due to the change of the DEFAULT value:
ROOT/LEAF 460 perm entries : 1 [block 0]
bottom : 93 filevers: 14888 convvers: 83
writecnt: 1
1: (pos 00081)
00001 recLen : 12 recKeyLen : 4
00005 recVarcolOff: 0 recVarcolCnt: 0
record
1 2 3 4 5 6 7 8 9 10 11 12
81 82 83 84 85 86 87 88 89 90 91 92
dec: 12 0 4 0 0 0 0 0 32 65 0 0
hex: 0C 00 04 00 00 00 00 00 20 41 00 00
chr: A
And this is how it looks like after the explicit UPDATE:
ROOT/LEAF 460 perm entries : 1 [block 0]
bottom : 93 filevers: 14888 convvers: 84
writecnt: 2
1: (pos 00081)
00001 recLen : 11 recKeyLen : 3
00005 recVarcolOff: 0 recVarcolCnt: 0
record
1 2 3 4 5 6 7 8 9 10 11
81 82 83 84 85 86 87 88 89 90 91
dec: 11 0 3 0 0 0 0 0 32 65 0
hex: 0B 00 03 00 00 00 00 00 20 41 00
chr: A
Little difference but this leads to the problems during the foreign key validation.
I'll inform the developers next week about this.
As a workaround you'll have to explicitly update the columns for which you change the default setting.
regards,
Lars -
From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?
Hi,
Use NVL or COALESCE:
NVL (col_a, col_b)
Returns col_a if col_a is not NULL; otherwise, it returns col_b.
Col_a and col_b must have similar (if not identical) datatypes; for example, if col_a is a DATE, then col_b can be another DATE or it can be a TIMESTAMP, but it can't be a VARCHAR2.
For more about NVL and COALESCE, see the SQL Language manual: http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions119.htm#sthref1310
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the forum FAQ: https://forums.oracle.com/message/9362002 -
Difference between Not Null and Null..
Hi All,
In Conditional Region portion i would like to know the difference between
Value of item in Expression 1 is not null and we will assign the text filed name in expression.
Value of item in Expression 1 is null
When we have use the above two scenerio's ..
Not null means what it has some value in text filed or not.
pls help me out.
Anoo..Hello Anoo,
Validations check the input and will return an error message if the validation is not met (like 'Field is required').
Conditions can be used to run a Process (or render an item) when some condition is met - or not- (like do this only when field is not null).
Greetings,
Roel
http://roelhartman.blogspot.com/
http://www.bloggingaboutoracle.org/
http://www.logica.com/ -
Crystal report default values not showing in BOE
Hi,
In Crystal Designer 2008, we can set parameters to have a default value. When we refresh the report in Designer, the default value is the one that's automatically selected. However, once we upload it to BOE, the default value is blank and we must manually re-create them in the Default Value Properties. Anyone knows why it is like that?Hello,
Make sure you mark the items you want on Defaults inside CAC1 t-code.
You have the following options and from where are they taken of:
- Controlling area -> from IT0001
- Activity type -> from IT0315
- Purchase order -> from IT0315
- Attendance/Absence type -> directly entered in CAC1
- Master cost center -> from IT0000
- Sender business process -> from IT0315
- Service master -> from IT0315
- Cost center -> from IT0315
- Wage type -> directly entered in CAC1
Regards,
Bentow. -
I have a scenario where it has multiple parameters like.....
Period which consists of "Year,Quarter,Month" as a values.
When user selects "Year" value in "Period" Parameter then "FromMonth" has to set its default value as 36th month from now.
Example: If user selects "Year" then "FromMonth" has to show "April-11".
When user selects "Year" value in "Period" Parameter then "EndMonth" has to set its default value as current month.
Example: If user selects "Year" then "FromMonth" has to show "March-14".
If user selects "Month" Value in "Period" Parameter then it has to allow user to select the Month Range and again if user selects "Year" value in "Period" Parameter then StartMonth has to show 36th month from now and
End Month has to show current month.
Please help me how to resolve this issue.
Thanks in Advance.Hi Vasu_479,
First, you need to create a dataset to set the StartDate and EndDate parameter's value using the query provided by Visakh. And then use the StartDate and EndDate parameter to filter the data in MDX query. Here is a sample query for your reference.
select
{[Measures].[Internet Sales Amount]
} on columns,
{[Date].[Date].members} on rows
from(
select
STRTOMEMBER("[Date].[Date].&["+@StartDate+"]"):STRTOMEMBER("[Date].[Date].&["+@EndDate+"]")
) on columns
from [Adventure Works]
Hope this helps.
Regards,
Charlie Liao
TechNet Community Support -
Hi, I am trying to properly display a list of tasks for a project however without a join to the project number (which I was aware of) and the employee table, I get over 500 results.
The task can be created without a employee assigned to it so therefore the page does not require the field to be filled in.
Here is the SQL code, any does anyone have any ideas?
select
pd.pk_proj_detail_id "Task Number",
pd.task_title "Task Title",
pd.DETAIL_STATUS "Task Status",
pm.name "Associated Project",
pps.last_name||', '||pps.first_name||', '||pps.middle_initial||'.' "Assigned Employee",
pd.TRACKIT_NUMBER "TrackIt! Number",
pd.CREATEBY_DATE "Date Entered",
pd.DATE_BEGIN "Date Began",
pd.ESTIMATED_DATE "Estimated Completion Date",
pd.DATE_END "Date Completed"
from
PROTRAC_DETAIL pd,
protrac_master pm,
cobr.vw_pps_payroll pps,
resources r
where
pd.fk_proj_master_id = pm.PK_PROJ_MASTER_ID
and r.fk_master_id = pm.PK_PROJ_MASTER_ID
and (r.emp_id = pps.emple_no
or r.emp_id is null)It's 10g r2 with Application Express 3.1.0.00.32
This is the tasks (detail) table
ALTER TABLE PROTRAC_DETAIL
DROP PRIMARY KEY CASCADE;
DROP TABLE PROTRAC_DETAIL CASCADE CONSTRAINTS;
CREATE TABLE PROTRAC_DETAIL
PK_PROJ_DETAIL_ID NUMBER NOT NULL,
FK_PROJ_MASTER_ID NUMBER,
TRACKIT_NUMBER NUMBER,
DETAIL_DESCRIPTION VARCHAR2(4000 CHAR),
DETAIL_STATUS VARCHAR2(19 CHAR),
DETAIL_STATUS_COMMENT VARCHAR2(4000 CHAR),
DATE_BEGIN DATE,
DATE_END DATE,
ESTIMATED_DATE DATE,
CREATEBY_DATE DATE,
CREATEBY_USER VARCHAR2(50 CHAR),
LASTMOD_DATE DATE,
LASTMOD_USER VARCHAR2(50 CHAR),
TASK_TITLE VARCHAR2(100 CHAR)
TABLESPACE DEVPROTRAC_DATA
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
CREATE UNIQUE INDEX PROTRAC_DETAIL_PK ON PROTRAC_DETAIL
(PK_PROJ_DETAIL_ID)
TABLESPACE DEVPROTRAC_DATA
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
CREATE OR REPLACE TRIGGER BUI_PROTRAC_DETAIL
before insert or update
on PROTRAC_DETAIL
referencing new as New old as Old
for each row
begin
if inserting then
select users_seq.nextval, sysdate, apex_application.g_user
into :new.pk_proj_detail_id, :new.createby_date, :new.createby_user
from dual;
elsif updating then
select sysdate, apex_application.g_user
into :new.lastmod_date, :new.lastmod_user
from dual;
end if;
end;
SHOW ERRORS;
ALTER TABLE PROTRAC_DETAIL ADD (
CONSTRAINT PROTRAC_DETAIL_PK
PRIMARY KEY
(PK_PROJ_DETAIL_ID)
USING INDEX
TABLESPACE DEVPROTRAC_DATA
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
ALTER TABLE PROTRAC_DETAIL ADD (
CONSTRAINT PROTRAC_DETAIL_NUM
FOREIGN KEY (FK_PROJ_MASTER_ID)
REFERENCES PROTRAC_MASTER (PK_PROJ_MASTER_ID));
ALTER TABLE DEVPROTRAC.RESOURCES ADD (
FOREIGN KEY (FK_DETAIL_ID)
REFERENCES DEVPROTRAC.PROTRAC_DETAIL (PK_PROJ_DETAIL_ID));
SET DEFINE OFF;
Insert into PROTRAC_DETAIL
(PK_PROJ_DETAIL_ID, FK_PROJ_MASTER_ID, TRACKIT_NUMBER, DETAIL_DESCRIPTION, DETAIL_STATUS,
DETAIL_STATUS_COMMENT, DATE_BEGIN, DATE_END, ESTIMATED_DATE, CREATEBY_DATE,
CREATEBY_USER, LASTMOD_DATE, LASTMOD_USER, TASK_TITLE)
Values
(34, 24, NULL, 'test', 'Queued',
NULL, NULL, NULL, NULL, TO_DATE('10/30/2008 13:37:01', 'MM/DD/YYYY HH24:MI:SS'),
'LREDMOND', TO_DATE('11/03/2008 15:19:35', 'MM/DD/YYYY HH24:MI:SS'), NULL, 'bananana');
Insert into PROTRAC_DETAIL
(PK_PROJ_DETAIL_ID, FK_PROJ_MASTER_ID, TRACKIT_NUMBER, DETAIL_DESCRIPTION, DETAIL_STATUS,
DETAIL_STATUS_COMMENT, DATE_BEGIN, DATE_END, ESTIMATED_DATE, CREATEBY_DATE,
CREATEBY_USER, LASTMOD_DATE, LASTMOD_USER, TASK_TITLE)
Values
(41, 40, NULL, '2354234', 'Queued',
NULL, NULL, NULL, NULL, TO_DATE('10/31/2008 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
'LREDMOND', TO_DATE('11/03/2008 13:52:02', 'MM/DD/YYYY HH24:MI:SS'), 'LREDMOND', 'I can type on the keyboarddf');
Insert into PROTRAC_DETAIL
(PK_PROJ_DETAIL_ID, FK_PROJ_MASTER_ID, TRACKIT_NUMBER, DETAIL_DESCRIPTION, DETAIL_STATUS,
DETAIL_STATUS_COMMENT, DATE_BEGIN, DATE_END, ESTIMATED_DATE, CREATEBY_DATE,
CREATEBY_USER, LASTMOD_DATE, LASTMOD_USER, TASK_TITLE)
Values
(49, 32, 78888, 'one day fishsticks will walk on the moon.', 'Queued',
'waiting for fishsticks.', NULL, NULL, NULL, TO_DATE('11/03/2008 11:28:11', 'MM/DD/YYYY HH24:MI:SS'),
'LREDMOND', NULL, NULL, 'Fix the keyboard');
Insert into PROTRAC_DETAIL
(PK_PROJ_DETAIL_ID, FK_PROJ_MASTER_ID, TRACKIT_NUMBER, DETAIL_DESCRIPTION, DETAIL_STATUS,
DETAIL_STATUS_COMMENT, DATE_BEGIN, DATE_END, ESTIMATED_DATE, CREATEBY_DATE,
CREATEBY_USER, LASTMOD_DATE, LASTMOD_USER, TASK_TITLE)
Values
(50, 38, NULL, 'dfdfdfdfdfdfdfdfdf', 'Queued',
NULL, NULL, NULL, NULL, TO_DATE('11/03/2008 12:03:06', 'MM/DD/YYYY HH24:MI:SS'),
'LREDMOND', TO_DATE('11/03/2008 15:19:44', 'MM/DD/YYYY HH24:MI:SS'), NULL, 'resreeeeeeeeee');
Insert into PROTRAC_DETAIL
(PK_PROJ_DETAIL_ID, FK_PROJ_MASTER_ID, TRACKIT_NUMBER, DETAIL_DESCRIPTION, DETAIL_STATUS,
DETAIL_STATUS_COMMENT, DATE_BEGIN, DATE_END, ESTIMATED_DATE, CREATEBY_DATE,
CREATEBY_USER, LASTMOD_DATE, LASTMOD_USER, TASK_TITLE)
Values
(33, 31, NULL, 'Make sure the bananas are fresh', 'Queued',
NULL, NULL, NULL, NULL, TO_DATE('10/29/2008 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
'LREDMOND', TO_DATE('11/03/2008 15:19:52', 'MM/DD/YYYY HH24:MI:SS'), NULL, 'e543563465');
Insert into PROTRAC_DETAIL
(PK_PROJ_DETAIL_ID, FK_PROJ_MASTER_ID, TRACKIT_NUMBER, DETAIL_DESCRIPTION, DETAIL_STATUS,
DETAIL_STATUS_COMMENT, DATE_BEGIN, DATE_END, ESTIMATED_DATE, CREATEBY_DATE,
CREATEBY_USER, LASTMOD_DATE, LASTMOD_USER, TASK_TITLE)
Values
(48, 37, NULL, 'guitar heros! yay', 'Queued',
NULL, NULL, NULL, NULL, TO_DATE('11/03/2008 11:26:06', 'MM/DD/YYYY HH24:MI:SS'),
'LREDMOND', TO_DATE('11/03/2008 15:19:57', 'MM/DD/YYYY HH24:MI:SS'), NULL, '34444444444444543etfg');
COMMIT;This is for the resources table:
ALTER TABLE RESOURCES
DROP PRIMARY KEY CASCADE;
DROP TABLE RESOURCES CASCADE CONSTRAINTS;
CREATE TABLE RESOURCES
PK_RESOURCES_ID NUMBER,
FK_DETAIL_ID NUMBER,
EMP_ID NUMBER,
RESOURCE_STATUS VARCHAR2(8 CHAR),
RESOURCE_COMMENT VARCHAR2(4000 CHAR),
CREATEBY_DATE DATE,
CREATEBY_USER VARCHAR2(50 CHAR),
LASTMOD_DATE DATE,
LASTMOD_USER VARCHAR2(50 CHAR),
FK_MASTER_ID NUMBER
TABLESPACE DEVPROTRAC_DATA
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
CREATE UNIQUE INDEX RESOURCES_PK ON RESOURCES
(PK_RESOURCES_ID)
TABLESPACE DEVPROTRAC_DATA
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
CREATE OR REPLACE TRIGGER BUI_RESOURCES
before insert or update
on RESOURCES
referencing new as New old as Old
for each row
begin
if inserting then
select users_seq.nextval, sysdate, apex_application.g_user
into :new.pk_resources_id, :new.createby_date, :new.createby_user
from dual;
elsif updating then
select sysdate, apex_application.g_user
into :new.lastmod_date, :new.lastmod_user
from dual;
end if;
end;
SHOW ERRORS;
ALTER TABLE RESOURCES ADD (
CONSTRAINT RESOURCES_PK
PRIMARY KEY
(PK_RESOURCES_ID)
USING INDEX
TABLESPACE DEVPROTRAC_DATA
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
ALTER TABLE RESOURCES ADD (
FOREIGN KEY (FK_DETAIL_ID)
REFERENCES PROTRAC_DETAIL (PK_PROJ_DETAIL_ID),
FOREIGN KEY (FK_MASTER_ID)
REFERENCES PROTRAC_MASTER (PK_PROJ_MASTER_ID));
SET DEFINE OFF;
Insert into RESOURCES
(PK_RESOURCES_ID, FK_DETAIL_ID, EMP_ID, RESOURCE_STATUS, RESOURCE_COMMENT,
CREATEBY_DATE, CREATEBY_USER, LASTMOD_DATE, LASTMOD_USER, FK_MASTER_ID)
Values
(53, 50, 356654, 'Active', NULL,
TO_DATE('11/04/2008 09:32:06', 'MM/DD/YYYY HH24:MI:SS'), 'LREDMOND', NULL, NULL, NULL);
Insert into RESOURCES
(PK_RESOURCES_ID, FK_DETAIL_ID, EMP_ID, RESOURCE_STATUS, RESOURCE_COMMENT,
CREATEBY_DATE, CREATEBY_USER, LASTMOD_DATE, LASTMOD_USER, FK_MASTER_ID)
Values
(51, 41, 447250, 'Active', 'No Sure.',
TO_DATE('11/03/2008 14:23:11', 'MM/DD/YYYY HH24:MI:SS'), NULL, TO_DATE('11/04/2008 09:00:04', 'MM/DD/YYYY HH24:MI:SS'), NULL, 40);
Insert into RESOURCES
(PK_RESOURCES_ID, FK_DETAIL_ID, EMP_ID, RESOURCE_STATUS, RESOURCE_COMMENT,
CREATEBY_DATE, CREATEBY_USER, LASTMOD_DATE, LASTMOD_USER, FK_MASTER_ID)
Values
(54, 50, 323829, 'Active', NULL,
TO_DATE('11/04/2008 10:26:08', 'MM/DD/YYYY HH24:MI:SS'), 'LREDMOND', NULL, NULL, 38);
Insert into RESOURCES
(PK_RESOURCES_ID, FK_DETAIL_ID, EMP_ID, RESOURCE_STATUS, RESOURCE_COMMENT,
CREATEBY_DATE, CREATEBY_USER, LASTMOD_DATE, LASTMOD_USER, FK_MASTER_ID)
Values
(52, 33, 8915, 'Active', 'get to work',
TO_DATE('11/03/2008 15:20:18', 'MM/DD/YYYY HH24:MI:SS'), 'LREDMOND', TO_DATE('11/03/2008 15:35:10', 'MM/DD/YYYY HH24:MI:SS'), NULL, NULL);
COMMIT;The results I want is everything above regardless of emp_id assigned (if any). Without the r.emp_id = pps.emple_no join, the query will generate 234234239482304234 results.
Hope this helps.
Edited by: leland on Nov 4, 2008 12:56 PM -
Get list of Not Null and PK Columns
hi All,
I need to get the list of all the columns which are part of PK and not null, can you help me on this?
with the below query I am getting the not null ones but need to get the PK columns also
SqlServer Version is 2008R2
SELECT TABLE_CATALOG AS Database_Name, TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, IS_NULLABLE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = 'Express'
AND IS_NULLABLE = 'NO'
Thanks!
NeilGive this a go. It includes by bitval solver function, as the status column is stored that way.
CREATE FUNCTION dbo.solveBitVal(@val BIGINT)
RETURNS @result TABLE (id INT, bitvalue BIGINT)
BEGIN
DECLARE @bitTranslate TABLE (id INT, bitvalue BIGINT)
DECLARE @numbah TABLE (num INT)
DECLARE @loopah INT
SET @loopah = 1
WHILE @loopah <= 63
BEGIN
INSERT INTO @bitTranslate (id, bitvalue) VALUES (@loopah, POWER(CAST(2 AS BIGINT),@loopah-1))
INSERT INTO @numbah (num) VALUES (@loopah)
SET @loopah = @loopah + 1
END
WHILE @val > 0
BEGIN
INSERT INTO @result
SELECT MAX(id), MAX(bitvalue) FROM @bitTranslate WHERE bitvalue <= @val
SELECT @val = @val - MAX(bitvalue) FROM @bitTranslate WHERE bitvalue <= @val
END
RETURN
END
GO
;WITH cons AS (
SELECT o.name, c.*, b.id AS statusID, ROW_NUMBER() OVER (PARTITION BY c.id, colid ORDER BY b.id) AS seq
FROM sys.sysconstraints c
INNER JOIN sys.objects o
ON c.id = o.object_id
CROSS APPLY dbo.solveBitVal(c.status) b
), rCTE AS (
SELECT c.name, c.constid, c.id, c.colid, c.spare1, c.status, c.actions, c.error, CAST(CASE WHEN statusID = 1 THEN 'PRIMARY KEY constraint '
WHEN statusID = 2 THEN 'UNIQUE KEY constraint '
WHEN statusID = 3 THEN 'FOREIGN KEY constraint '
WHEN statusID = 4 THEN 'CHECK constraint '
WHEN statusID = 5 THEN 'DEFAULT constraint '
WHEN statusID = 16 THEN 'Column-level constraint'
WHEN statusID = 32 THEN 'Table-level constraint '
END AS NVARCHAR(MAX)) AS statusName, c.seq, c.statusID
FROM cons c
WHERE seq = 1
UNION ALL
SELECT c.name, c.constid, c.id, c.colid, c.spare1, c.status, c.actions, c.error, CAST(r.statusName + ', ' + CASE WHEN c.statusID = 1 THEN 'PRIMARY KEY constraint '
WHEN c.statusID = 2 THEN 'UNIQUE KEY constraint '
WHEN c.statusID = 3 THEN 'FOREIGN KEY constraint '
WHEN c.statusID = 4 THEN 'CHECK constraint '
WHEN c.statusID = 5 THEN 'DEFAULT constraint '
WHEN c.statusID = 16 THEN 'Column-level constraint'
WHEN c.statusID = 32 THEN 'Table-level constraint '
END AS NVARCHAR(MAX)), c.seq, c.statusID
FROM cons c
INNER JOIN rCTE r
ON c.id = r.id
AND c.colid = r.colid
AND c.seq - 1 = r.seq
SELECT *
FROM rCTE
Don't forget to mark helpful posts, and answers. It helps others to find relevant posts to the same question. -
Setting default value to NULL values when using Get-ADUser
I am running a simple command of
Get-ADUser -properties * | Select firstname, lastname, department | Export-Csv results.csv -NoTypeInformation
If the users department field is NULL, I would like to set a default value of "NODEPT" within my CSV results. I have tried a ForEach loop statement but I can't seem to figure this one out.
What is not explicitly allowed should be implicitly deniedHi,
Try this:
Get-ADUser -Filter * -Properties department |
Select GivenName,Surname,@{N='Department';E={ If ($_.Department) { $_.Department } Else { 'NODEPT' } }} |
Export-Csv .\userList.csv -NoTypeInformation
https://technet.microsoft.com/en-us/library/ff730948.aspx
Don't retire TechNet! -
(Don't give up yet - 13,225+ strong and growing) -
Not null and enable or disable column in tabular form
Hi,
Using apex version 4.1 and working on tabular form.
ACT_COA_SEGMENT_MAS is Master table
and
ACT_SEGMENT_VALUES_MAS is detail table
I have entered 8 rows in master table and PARENT_SEGMENT_ID is column in master table which is null able. If i specified PARENT_SEGMENT_ID with value in master table then in detail table there is column PARENT_ID that should not be null and enable.
How i can enable or disable column when in master table PARENT_SEGMENT_ID column is null then in detail table PARENT_ID column should disable and vice versa.
I have created tabular form on Detail table. before insert into the tabular form Check in master table in first entry if PARENT_SEGMENT_ID is not null in first row of master table then in tabular form PARENT_ID should enable and not null able in corresponding to this first row id's lines in tabular form.
Same should check for second row in master table if PARENT_SEGMENT_ID is not null then entered rows with PARENT_ID into tabular form corresponding to 2nd id in master table should not nullable and column should enable in tabular form.
Thanks & Regards
Vedant
Edited by: Vedant on Jan 9, 2013 9:12 PMVedant,
You need to create you own manual tabular form and not use the wizard.
Using APEX_ITEM api you should be build you own form and you will be able to control how you wan to display the rows. (See Link [Apex Item Help|http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35127/apex_item.htm#CACEEEJE] )
select case when PRIMARY_TABLE_COLUMN is null then APEX_ITEM.DISPLAY_AND_SAVE(3 , DETAIL_COLUMN ) else APEX_ITEM.TEXT(2,detail_column) end "ALIAS" from detail table
Hope that help.
Vivek -
I have a performance issue with a query - it would be something like -
select col1,col2, sum(col3), get_val(col_4)
from table1
where
get_val(col_4) is not null
group by col1,col2, get_val(col_4)
I have simplified this but it is something similar. This works great - performance is great. Now I commented out the where clause as I needed to populate null values - and that's it the query does not retrieve the resultset - it keeps running forever. With the where clause it comes back in 60 seconds. There is only one row out of 560 rows that has null value for col_4 which i need to display.
Any help is appreciated.The only difference I notice between the two sqls is HASH(UNIQUE) -
with IS NOT NULL in where clause -
SELECT STATEMENT ALL_ROWS 1598 1 209
HASH(UNIQUE) 1598 1 209
HASH(GROUP BY) 1598 1 209
When is not null is removed from the where clause -
SELECT STATEMENT ALL_ROWS 1598 1 206
HASH(GROUP BY) 1598 1 206
I'm guessing that the index is being used in the first scenario and not in the second. Any idea/suggestion as to how to over come this?
Thanks -
Ssrs parameter default value not showing ,when available values is binded to query dataset
I have developed a report using sql server data tools for vsiual studio2012 ,i have defined few parameters ,on one of the parameter when available values is binded to a dataset query, the report default value is not showing in report preview .
Many Thanks
ChandraHi Chandra,
According to your description, you have set the default value for a parameter, but it's not displayed when initially running the report. Right?
In this scenario, since you have set the available values bind to query, so your default values should be within these available values. If these default values are not within the available values, the default values will be not displayed. So please check
the default values.
Reference:
Add, Change, or Delete Default Values for a Report Parameter (Report Builder and SSRS)
If you have any question, please feel free to ask.
Best Regards,
Simon Hou -
Assigning default values to root and subnode attributes
Hello,
I created a BO with a root node. In order to assign some default values after a root instance is created, I've implemented a determination. Everything is working as expected. When the instance is created (and only then) the init method is processed and the default values get assigned.
As a next step, I added a subnode. I need to assign some default values to a new instance as well. So, I've created a determination for this subnode, in the same way as I did it for the root node.
Now, when a new instance is created, the init method of the root is processed, but not the init method of the subnode. Only when I change a value of a subnode attribute and do a save, the init method of the subnode is processed and the init method of the root node as well (overwriting any changes with the default values, which is wrong).
How can I achieve that after instance creation (and only at this point), the init method of the root and then the init method of the subnode are processed?
Thanks for any advice.
regards,
UlliHi Ulli,
It should work if you have configured as rightly mentioned by Tilmann.
but If you want to debug the framework to understand the behaviour, you have to go to class - /BOBF/CL_FRW.
Put a break-point in any of these method - CHECK_AND_DETERMINE / DO_DETERMINATIONS
/ DO_DETERMINATIONS_RETRIEVE
/ DO_DETVAL
Thanks,
Bharath. -
Tax codes - can you set up default value for rows and freight? HELP!
Hello - I have two issues with tax codes:
1. When adding a sales order if any of the rows do not have a value for "Tax Code" I will get an error "Row without tax was found".
- How can I get all rows on my sales orders, documents, etc to default to a specific tax code? Or will users ALWAYS have to enter the tax code?
2. When addring a sales order with Freight, if the order is added without adding a tax code to the freight I will get an error "Expense with tax was found"
- How can I get the tax code have a default value? We always use the same tax code, so it is redundant to have to enter this information.
Any suggestions?Hi Jhon,
this is the simplest and best way to make a Tax Code default is Go to
Answer for Question 1
Administration -> Setup -> Financial -> Tax -> Tax Code Determination (Click on this)
in that screen you can set a default tax code for both sales as well as Purchase.
If you want to set Tax Code based on Vendors or Customers or Items separately then you can use the Key Fields.
Answer for Question 2
Once you enter the Tax Code in the freight i think it takes the Tax Code itself, I'm not so sure about this one though.
Hope this helps you out
regards,
Shreyas -
CRMD_ORDER: how to set default values for Requester and Change Manager
Hello Folks,
how do I set default values in TA crmd_order?
I drew my organizational hierarchy using TAs bp and ppoma_crm.
When a new Change Request (e. g. SDHF) is created, I want the four roles (Requester, Change Manager, IT Operator and Developer) to be set automatically, not manually.
Both Requester (= Key User) and Change Manager are derivable. I did not find anything in SPRO neither in the OSS neither here.
Points will be rewarded as a matter of course!
Thanx in advance!Hi Dirk,
look for Define Access Sequence & Define Partner Determination Procedure in SPRO and read the IMG Activity Documentation. You can find it in the Service Desk config, but it works for the other transaction types too.
Basically, you create Access Sequences where you tell the Partner Determination Procedure where to look for the values for the Partner Function fields.
The Access Sequence can use lots of sources for the information, including your org structure.
regards,
Jason
Maybe you are looking for
-
Mod_jk for apache2, tomcat 5 and solaris 10
when i compile mod_jk in solaris 10 x86 box it shows following error: /bin/bash /var/apache2/build/libtool --silent --mode=compile gcc -I/usr/apache2/include -g -O2 -O -xarch=386 -xchip=pentium -xspace -Xa -xildoff -DSSL_EXPERIMENTAL -DSSL_ENGINE -DH
-
Oracle to SQL server connection - not working
Hi Friends, OS version : R Linux EL5 Oracle version : 10.2.0.4 i had followed http://www.databasejournal.com/features/oracle/article.php/10893_3442661_2/Making-a-Connection-from-Oracle-to-SQL-Server.htm document and modified tnsnames.ora, listener.or
-
Adobe Muse: can it upload to an sftp site as well as an ftp site?
I work at a college and normally I would just upload my web content onto a server. However, from what I've read (and please correct me if I'm wrong) but everytime I'd make a change I'd have to export the whole site and upload it again. So... I'm tr
-
Adding WBS element to level-2 in existing project
Hi all, I have a new WBS Element created in a project which already has 2 wbs elements created in a level 2 hierarchy before . Now , this new element is created at level-1 by default .I want to modify the project hierarchy adding the newly created el
-
I am currently using Nokia Lumia 520 : While typing messages in my Nokia Lumia 520, I am not able to scroll back and rectify the words or spelling mistake. currently i have to delete the complete word. Also not able to scroll up and down in the typed