Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I'm still working on my university tasks and here I have to create trigger on table
MARRIAGE(ID_marriage, Date_of_wedding, Date_of_divorce);
which would work on UPDATE statement so that if someone tries to add or edit date_of_divorce it would make sure that it is AFTER date_of_wedding.
Here's how example of data looks:
ID_marriage | Date_of_wedding | Date_of_divorce
1 39/04/12 39/04/12
2 71/04/12 null
Now my question is how do I compare such dates in PL/SQL?
Thanks in advance!
No need for a trigger, a check constraint will work do:
alter table marriage
add constraint check_divorce
check (date_of_divorce is null or date_of_divorce > date_of_wedding);
As for the trigger, you need to compare the values of new.date_of_divorce and new.date_of_wedding - essentially the same condition as I have used in the check constraint. If the date_of_divorce is bigger you need to raise an exception to abort the insert or update statement.
As this is a school project, I won't give you the full code, you should find the correct syntax on your own.
The relevant chapters in the manual are:
http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/triggers.htm#LNPLS99955
http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/errors.htm#LNPLS00705
http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/triggers.htm#LNPLS781
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
Show transaction details – SB a/c no., transaction type, date, description and amount, for transaction amounts > 1000. Sort the output based on a/c no, transaction type and date.
The way you described it, that would be something like this:
select sb a/c no., transaction type, description, amount
from some table
where amount > 1000
order by a/c no, transaction type, date
Of course, it won't work, column names can't have those names (at least, some of them), but - you didn't put much effort in question, so don't expect miracle on my side.
Also, what does "solution is not getting accepted" mean?
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I have to develop an ABAP report program. After it's execution, I have to display a popup with evaluating it's performance. It's possible? I mean without using transaction SAT.
The scenario is simple:
1) Run report from se38 or it's using related tcode
2) After running - display the performance.
Please give me any idea how to do that. Thank you.
I assume that you want to measure the runtime of the report.
So, you could easily save the timestamp of the beginning of the program into an variable and when the execution logic finished, you can get another timestamp.
If you subtract timestamp 1 from timestamp 2, you have your running time.
For simple measurements you can you this snippet:
DATA: t1 TYPE i,
t2 TYPE i.
DATA: gt_tabrows TYPE TABLE OF exp_tablrows,
toff TYPE p DECIMALS 2.
GET RUN TIME FIELD t1.
SELECT tabname
FROM dd02l
INTO CORRESPONDING FIELDS OF TABLE gt_tabrows
WHERE tabname LIKE 'Y%'.
CALL FUNCTION 'EM_GET_NUMBER_OF_ENTRIES'
TABLES
it_tables = gt_tabrows.
GET RUN TIME FIELD t2.
toff = t2 - t1.
cl_demo_output=>new( )->begin_section(
|Y tables recordcount calculation:|
)->write_text(
| { toff } microseconds|
)->write_data( gt_tabrows )->display( ).
This sample outputs runtime of code calculating recordcounts of tables that start with Y.
If you run your programm in backgroup, the job-log gives you all your needed information.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I have a problem about my visual basic 6 program, I want to add an error message when a duplicate value is added by the user (I'm using SQL database). I tried a lot of codes but none of these works, I just deleted some of it. Here's the code. What code should I put to make it run? Please help, thanks in advance.
It is just a sample one, and I'm going to put the code to my original program if i am going to make it run.
You need to specify what do you consider as a duplicate line. A line with a IDNO that already exists or a line with IDNO and NAME that already exists?
Regardless the answer, you need to:
Define a unique key containing the fields that cannot have duplicate values. You must find out how to do that in your database management system. By doing that, you will have the guarantee that you will never have a duplicate line in your database.
Add a previous query to your code where you verify if there is a line in your table that already has the values you are trying to insert.
There are a number of ways to do this.
You could trap the error and check the error code/message, if it is "VIOLATION OF PRIMARY KEY CONSTRAINT" display the error message of your choice.
Personally I would check to see if it exists before the insert and if it does display the "The data you are trying to add already exists" message (or whatever it is you want to display).
On a side note you should look at Parameterized Queries. The query you have is open to SQL Injection. Take a look at this
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
My analysis report showing a unknown member with the dimension.
I verified with the columns not null or blank. Still having.
Please help.
Thanks,
http://www.bidn.com/blogs/DevinKnight/ssis/1419/ssas-%E2%80%93-hiding-unknown-member
This is I got to hide the unknown member data of dimension, but still won't get the unknown data.
Better than before, to hide the data from report.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
Magneto 1.5
Some default features in Magent just do not make any damn sense to me.
Take a look at the following image:
http://i.imgur.com/PBpGv.png
Why would I want an empty column on every row? It looks so bad and from what I've been Googling it seems quite troublesome to fix. This of course being in the older versions, I cannot find anything for Magento 1.5
Could anyone explain to me how to fill out the columns nicely?
Thanks in advance :)
You can determine the column count through layout/catalog.xml
Find the line that looks like this:
<action method="setColumnCount"><columns>4</columns></action>
Change the value of <columns></columns> to add/subtract columns.