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 days ago.
Improve this question
I want to change charset to select calderma table
when table is select query in oracle I would like to make the following changes
ALTER SESSION SET NLS_NUMERIC_CHARACTERS= ',.';
create or replace TRIGGER alter_session AFTER LOGON ON DATABASE
Begin
if ( osuser='solentra') then
execute immediate
'alter session set nls_date_fomat = ''dd-mon-yyyy hh24:mi:ss'' ';
End if;
End;
OR
create or replace TRIGGER alter_session AFTER LOGON ON DATABASE
Begin
if ( SELECT from calderma ) then
execute immediate
'alter session set nls_date_fomat = ''dd-mon-yyyy hh24:mi:ss'' ';
End if;
End;
I don't have much to do with pl\sql but I faced a problem like this, I will be glad if you help
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have a database table with these columns:
Banner_Title varchar(500)
Existing_Banner_Image varchar(500)
Banner_URL varchar(500)
Banner_ALT varchar(500)
CheckBoxText varchar(500)
[for these 3 checkboxes have taken chkArticles,chkFittness,chkHealthArticle
but I want to check checkboxes also while insertion of data.For that I added one extra column in datatable named as sectionId for chkArticle checkbox I will assign 10 as a sectionId ,for chkFittness sectionId 11 and for chkHealthArticle as 12 so when I insert banner_title='article1', click chkArticle checkbox and fill other field data as mentioned in table format from then data should insert but next time when I try banner_title='article1' and click same checkbox then data not allowed to insert.but when I give banner_name='article1' and click another checkbox chkFittness it should allowed though the name of banner is same but maintained sectionid for checkboxes is different then what changes need to do stored procedure?? Basically I want to maintained unique banner_title for each checkbox click and to differentiate I maintained sectionid.plz help me
Create Unique constraint:
USE YourDatebase;
GO
ALTER TABLE YourTable
ADD CONSTRAINT YourConstraintName UNIQUE (Banner_Title);
GO
Check if banner title exists before insert attempt:
IF NOT EXISTS(SELECT Banner_Title FROM YourTable WHERE Banner_Title =
'TitleYourAreAttemptingToInsert')
BEGIN
INSERT .....
END
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Create an index-by table and populate with rows from emp, then loop over and print them.
hi can anyone understand this question and give me the suggestions to solve this please..
A collection is an ordered group of elements having the same data type
which can be accessed though subscript/index. Oracle PL/SQL supports
three different types of collection
Index-by tables or Associative array
Nested table
Variable-size array or Varray
Below is an example of how you can define a Index-by table and populate it with rows from Emp table and print them accordingly.
DECLARE
CURSOR c_emp is
select name from emp;
TYPE c_list IS TABLE of emp.name%type INDEX BY binary_integer;
name_list c_list;
counter integer :=0;
BEGIN
FOR n IN c_emp LOOP
counter := counter +1;
name_list(counter) := n.name;
dbms_output.put_line('Employee('||counter|| '):'||name_list(counter));
END LOOP;
END;
/
See Oracle Documentation as well as PL/SQL - Collections for more information on the same.
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
I have create procedure code, what is a delete procedure code.
Create procedure [dbo].[saveemp]
#Empname varchar(50),
#EmpAddress varchar(50),
#EmpDOB int,
#EmpGender varchar(50)
as
begin
insert employee(Empname, EmpAddress, EmpDOB, EmpGender)
values (#Empname, #EmpAddress, #EmpDOB, #EmpGender)
end
you are missing into in insert statement
insert into employee(Empname,EmpAddress,EmpDOB,EmpGender)
values
(#Empname,#EmpAddress,#EmpDOB,#EmpGender)
for deleting row using procedure
Create procedure [dbo].[deleteempname]
#Empname varchar(50)
as
BEGIN
DELETE FROM employee WHERE Empname= #Empname
END
Are you looking for "drop procedure"? http://technet.microsoft.com/en-us/library/ms174969.aspx
To delete the whole table, your query will be,
DELETE FROM employee
And to delete a single row (depending upon a parameter) it will be like,
DELETE FROM employee WHERE EmpName= #EmpName
It will be better if you delete a row depending upon the primary key (if you have any),
DELETE FROM employee WHERE EmpID = #EmpID
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 want to update details using linq to entities. But instead of takin a new aspx page i want to update details in another view. will it work.? and please give the linq to entity update query
Let us assume:
db is the context of your Database Entity.
Table_name is the name of Table you need to update.
row_id is the value you are using to search for the data in the Table.
To update using linq you need to fetch the record first using the below query:
var data = (from r in db.Table_name
where r.id == row_id
select r).FirstOrDefault();
Now to update the values just update them. For example:
data.Name = "Firstname lastname"
data.IsActive = true;
.
.
and so on
After you have updated the values in data you need to Save the changes made by you by this command:
db.SaveChanges();
That's it.
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 9 years ago.
Improve this question
I am new to Oracle PL/SQL.Being a procedural language why do we have to do nesting multiple times ?
Thanks in advance.
Nesting of blocks help in exception handling.
for example:
begin -- BLOCK A
begin --BLOCK B
Statement1;
end; --End of block B
end; --End of block A
If there is an error in the execution of statement1, an exception is raised this exception will navigate to the outer block (A) as it is unhandled in block B. Consider another example below
begin -- BLOCK A
begin --BLOCK B
Statement1;
exception
when others then
Statement; --This statement is executed if there is an exception
end; --End of block B
end; --End of block A
In the above snippet, the exception will be handed within block B. It will not navigate to block A.