PROCEDURE emp_get_rec (emp_rec IN OUT NOCOPY emp_content%ROWTYPE)< br /> IS
v_cnt NUMBER;
BEGIN
SELECT COUNT(*)
INTO v_cnt
FROM emp_content
WHERE emp_id = emp_rec.emp_id;
IF v_cnt = 1
THEN
SELECT * INTO emp_rec
FROM emp_content
WHERE emp_id = emp_rec.emp_id;
END IF;
END emp_get_rec;
I am trying to convert in PostgreSQL,
Create or replace function emp_get_rec (emp_rec IN OUT emp_content%ROWTYPE)
AS $BODY$< br />DECLARE
v_cnt NUMBER;
BEGIN
SELECT COUNT(*)
INTO v_cnt
FROM emp_content
WHERE emp_id = emp_rec. emp_id;
IF v_cnt = 1
THEN
SELECT * INTO emp_rec
FROM emp_content
WHERE emp_id = emp_rec.emp_id;
END IF;
END;
$BODY$LANGUAGE'plpgsql';
I am facing the following error:
ERROR: syntax error at or near “ROWTYPE”
Whenever you create a table, a composite type is also automatically created, with the same name as the table, to represent the table’s row type.
Therefore, you can use the table name as the type name, syntactically it represents the type:
< /p>
create or replace function emp_get_rec (emp_rec IN OUT emp_content)
The following is a simple process in PL/SQL
< p>
PROCEDURE emp_get_rec (emp_rec IN OUT NOCOPY emp_content%ROWTYPE)
IS
v_cnt NUMBER;
BEGIN
SELECT COUNT(*)
INTO v_cnt
FROM emp_content
WHERE emp_id = emp_rec.emp_id;
IF v_cnt = 1
THEN
SELECT * INTO emp_rec
FROM emp_content
WHERE emp_id = emp_rec.emp_id;
END IF;
END emp_get_rec;
I tried to convert in PostgreSQL,
Create or replace function emp_get_rec (emp_rec IN OUT emp_content%ROWTYPE)
AS $BODY$
DECLARE
v_cnt NUMBER;
BEGIN
SELECT COUNT(*)
INTO v_cnt
FROM emp_content
WHERE emp_id = emp_rec.emp_id;
IF v_cnt = 1
THEN
SELECT * INTO emp_rec
FROM emp_content
WHERE emp_id = emp_rec.emp_id;
END IF;
END;
$BODY$LANGUAGE'plpgsql';
I am facing The following errors:
ERROR: syntax error at or near “ROWTYPE”
< p>Documentation says:
Whenever you create a table, a composite type is also automatically created, with the same name as the table, to represent the table’s row type.
Therefore, you can use the table name as the type name, and syntactically it means the type:
create or replace function emp_get_rec (emp_rec IN OUT emp_content)
WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 775 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC